How can I easily administer DNS servers by using the command prompt?

A GUI interface is great for novice administrators but is cumbersome if you have to perform the same task over and over again. Command line tools can be more efficient than GUI tools. Dnscmd.exe is one of the support tools from Support.cab, which is located in the support’tools directory on the Windows 2000 CD.
Dnscmd is provided as a command-line interface for managing DNS servers. This tool can be used to script batch files, to help automate management and update of existing DNS server configurations or to perform setup and configuration of new DNS servers on your network.
DNSCmd displays and changes the properties of DNS servers, zones, and resource records. It manually modifies these properties, creates and deletes zones and resource records, and forces replication events between DNS server physical memory and DNS databases and data files. Some operations of this tool work at the DNS server-level while others work at the zone-level.
You can use Dnscmd on any Windows 2000 or XP computer as long as the user that is running the application is a member in the Administrators or Server Operators group on the target computer. Both the user account and the server computer must be members of the same domain or reside within trusted domains.

Dnscmd.exe can be used to:

  • Get DNS server info;
  • Initiate server scavenging;
  • Enumerate and view zone info;
  • Create, delete, pause, and resume zones;
  • Change zone type (standard primary, standard secondary, AD integrated);
  • Add, delete, and enumerate records in a zone.

For example, to create a new standard primary zone called dpetri.net on a server named srv1.dpetri.net and stored in dpetri.net.dns files:

​dnscmd srv1.dpetri.net /ZoneAdd dpetri.net /Primary /file dpetri.net.dns

The syntax for adding DNS A records is similar:

​Dnscmd server_name /RecordAdd zone_name computer_name A IP_address

To add an A record for comp1 with an IP address of 192.168.1.100 in the dpetri.net zone on srv1.dpetri Windows Server 2003:

​Dnscmd srv1.dpetri.net /RecordAdd dpetri.net comp1 A 192.168.1.100

To manually force zone replication:

​Dnscmd server_name /ZoneRefresh zone_name

Links

Download Windows 2000 SP4 Support Tools (11.24mb)