Recipe 13.5. Viewing a DNS Server's ZonesProblemYou want to view the supported zones on a DNS Server. SolutionUsing a graphical user interface
Using a command-line interfaceRun 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 DiscussionUsing a graphical user interfaceWhen you click on either Forward Lookup Zones or Reverse Lookup Zones in the left pane, the right pane contains a Type column that displays each zone's type. Using a command-line interfaceUsing the /enumzones switch without any additional parameters displays all zones on the server. However, you can specify additional filters that limit the types of zones returned. With the Windows 2000 version of dnscmd, you can specify up to two filters: Filter1: /Primary /Secondary /Cache /Auto-Created Filter2: /Forward /Reverse With the Windows Server 2003 version of dnscmd, the filter behavior has changed. Instead of having two levels of criteria, you can specify one or more of the following: /Primary /Secondary /Forwarder /Stub /Cache /Auto-Created /Forward /Reverse /Ds /File /DomainDirectoryPartition /ForestDirectoryPartition /CustomDirectoryPartition /LegacyDirectoryPartition /DirectoryPartition <PartitionName> For more information on what each of these filters mean, run dnscmd /enumzones /?. Using VBScriptTo get the list of zones, I used a WQL query to find all MicrosoftDNS_Zone objects. You can add additional criteria to the WQL Select statement to return a subset of zones supported by the server if you need to. Look up the properties of the MicrosoftDNS_Zone class in MSDN to see the additional properties you can add to the query. See AlsoMSDN: MicrosoftDNS_Zone |