Recipe 13.1. Installing the DNS ServerProblemYou want to install the DNS Server. SolutionUsing a graphical user interface
Using a command-line interfaceCreate 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 VBScriptUnfortunately, 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 DiscussionThe 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.
See AlsoRecipe 2.4 and Recipe 13.2 |