Scripting DNS
- Scripting DNS
- Manually Installing DNS Zones Using dnscmd.exe
- Summary
In the second installment of our seven-part series on scripting in Windows 2000 Active Directory, we look at installing and configuring Domain Name Services by using two different kinds of scripts.
Scripting DNS
by Jim Hudson
This article is derived from Special Edition Using Active Directory, by Jim Hudson and Sean Fullerton (Que Publishing, November 2000).
Installing DNS Automatically Through Scripting
One of my favorite things about Windows 2000 is its scriptability. Whether through unattended setups, Windows Scripting Host, or WBEM, Windows 2000 provides a wealth of opportunities for scripting. In this section, we will look at installing DNS by using sysocmgr.exe. This executable provides the functionality we see when installing services through the Control Panel. In a later section, we will look at managing and configuring DNS using dnscmd.exe, a part of the Windows 2000 Support Tools.
The online help that ships with Windows 2000 is very well organized and searchable, and it provides a wealth of technical information for the asking. Many commands and tools are well represented in the Windows 2000 help files, but sysocmgr is not one of them. The good news is that it is very easy to use; once you have seen the functionality, you will find it helpful for installing virtually any service that is listed in the [components] or [netoptionalcomponents] section of unattend.doc. This document is part of the deploy.cab file in the \support\tools folder of the Windows 2000 CD. Knowledge Base article Q222444 has some information on using sysocmgr.
Using sysocmgr.exe to script the install of DNS is very straightforward. First, you need to create an answer file. This file can take the following form:
[netoptionalcomponents] dns=1
That really is it. This tells sysocmgr to install DNS using the same tools that we use to install it manually, but doing so without any user intervention.
You can then use this answer file with the following command, assuming that you created it and saved it as c:\scripts\answer.txt.
Sysocmgr.exe /i:sysoc.inf /u:c:\scripts\answer.txt
When you execute this command from the command prompt, you will see very briefly some of the same screens that you saw when installing DNS manually. The difference is that these will not require or accept user intervention. You may be asked to provide a path to the i386 subdirectory of your Windows 2000 CD. No other user intervention is required or allowed. Depending on the speed of your computer, this process may take 5 to 10 seconds.
The sysoc.inf file referenced in the previous command is automatically installed in \winnt\inf and does not need to be modified for this operation.