Recipe13.1.Installing the DNS Server


Recipe 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 /u:" & _                         strFile, 0, TRUE) if intRC <> 0 then    WScript.Echo "Error returned from sysocmgr command: " & intRC else    WScript.Echo "DNS Server installed" end if

Discussion

The Microsoft DNS Server is an optional operating system component that you can install on any Windows 2000 Server or Windows Server 2003 machine. The sysocmgr utility has additional options for suppressing dialog boxes (/x and /q). For the complete list of sysocmgr options, run sysocmgr /? from a command line.

You can also install the DNS Server using the Manage Your Server or Configure Your Server wizards.


See Also

Recipe 2.4 and Recipe 13.2



Windows Server Cookbook
Windows Server Cookbook for Windows Server 2003 and Windows 2000
ISBN: 0596006330
EAN: 2147483647
Year: 2006
Pages: 380
Authors: Robbie Allen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net