13.1. Installing the DNS Server

Problem

You want to install the DNS Server.

Solution

Using a graphical user interface

  1. From the Control Panel, open the Add or Remove Programs applet.

  2. Click on Add/Remove Windows Components.

  3. Double-click on Network Services.

  4. Check the box beside Domain Name System (DNS).

  5. Click OK.

  6. Click Next.

  7. Click Finish.

Using a command-line interface

Create a file using a text editor, such as notepad.exe , with the following contents:

[netoptionalcomponents]
dns=1

Next, run the sysocmgr utility with following parameters (assuming the file you just created is named c:\dns_install.txt):

> sysocmgr /i:%windir%\inf\sysoc.inf /u:c:\dns_install.txt

Using VBScript

Unfortunately, there are no native scripting interfaces for installing DNS Server. However, you can run the sysocmgr command from the previous section directly within a batch script (.bat extension) or using the WScript.Shell Run method within VBScript.

' This code simulates the same steps from the command-line solution. ' First an answer file is created containing the parameters to install ' the DNS Server. Then the sysocmgr command is invoked to perform the ' installation. strFile = "c:\dns_install.txt" constForWriting = 2 set objFSO = CreateObject("Scripting.FileSystemObject") set objFile = objFSO.OpenTextFile(strFile, constForWriting, True) objFile.WriteLine("[netoptionalcomponents]") objFile.WriteLine("dns=1") objFile.Close set objWshShell = WScript.CreateObject("WScript.Shell") intRC = objWshShell.Run("sysocmgr /i:%windir%\inf\sysoc.inf ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.