13.5. Viewing a DNS Server's Zones

Problem

You want to view the supported zones on a DNS Server.

Solution

Using a graphical user interface

  1. From the Administrative Tools, open the DNS snap-in (dnsmgmt.msc).

  2. Connect to the DNS Server you want to view. In the left pane, right-click on DNS and select Connect to DNS Server. Select The following computer and enter the target server name. Click OK.

  3. In the left pane, expand the target server and click Forward Lookup Zones or Reverse Lookup Zones to view the supported zones in the right pane.

Using a command-line interface

Run the following command to view the zones on a local DNS Server:

> dnscmd <ServerName> /enumzones

The following command enumerates the zones on server dns01:

> dnscmd dns01 /enumzones

Using VBScript

' This code lists the zones that are supported by the specified server.
' ------ SCRIPT CONFIGURATION ------
strServer = "<ServerName>"  ' e.g., dns01.rallencorp.com
' ------ END CONFIGURATION ---------
set objDNS = GetObject("winMgmts:\\" & strServer & "\root\MicrosoftDNS")
set objDNSServer = objDNS.Get("MicrosoftDNS_Server.Name="".""")
set objZones = objDNS.ExecQuery("Select * from MicrosoftDNS_Zone " & _
                                "Where DnsServerName = '" & _
                                objDNSServer.Name & "'") 
WScript.Echo "Zones on " & objDNSServer.Name
for each objZone in objZones
   WScript.Echo " " & objZOne.Name
next

Discussion

Using a graphical user interface

When you click on either Forward Lookup Zones or Reverse Lookup Zones in the left pane, the right pane contains a Type column ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.