An Installation and Configuration Batch Script

Now that we’ve covered the DNS installation and configuration commands, we’ll show you a short batch script that automates the initial setup of a secondary name server. This script performs the following tasks:

  1. Installs the DNS Server service using sysocmgr

  2. Adds a zone called fx.movie.edu using dnscmd

  3. Configures the server to use a forwarder using dnscmd

  4. Adds an A record for the name of the new server in the fx.movie.edu zone on the primary master server using dnscmd

  5. Performs a zone transfer from the primary master server to receive the latest updates using dnscmd

The only other utility used in the script is the sleep command, which is available in the Resource Kit. The sleep command is used to allow time for the changes initiated by each command to be committed.

Here is the script:

@echo off :: IP address of primary master server set PRIMARY_MASTER_IP=64.10.57.21 :: Forward-mapping zone to add to this server set FWD_ZONE=fx.movie.edu :: IP address of this server set SERVER_IP=10.50.23.7 echo Installing the DNS Server service . . . sysocmgr /i:%windir%\inf\sysoc.inf /u:c:\dns_install.txt :: The sleep command is part of the Resource Kit sleep 5 echo Adding a zone . . . dnscmd /zoneadd %FWD_ZONE% /Secondary %PRIMARY_MASTER_IP% sleep 5 echo Configuring this server to use a forwarder . . . dnscmd /resetforwarders %PRIMARY_MASTER_IP% sleep 5 echo Adding an A record for this server in %FWD_ZONE% dnscmd %PRIMARY_IP% /recordadd %FWD_ZONE% ...

Get DNS on Windows Server 2003, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.