Recipe 13.3 Viewing a Server's Zones13.3.1 ProblemYou want to view the zones on a server. 13.3.2 Solution13.3.2.1 Using a graphical user interface
13.3.2.2 Using a command-line interface> dnscmd <DNSServerName> /enumzones 13.3.2.3 Using VBScript' This code lists the zones that are supported by the specified server. ' ------ SCRIPT CONFIGURATION ------ strServer = "<DNSServerName>" ' e.g. dc1.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 13.3.3 Discussion13.3.3.1 Using a graphical user interfaceWhen you click on either the Forward Lookup Zones or Reverse Lookup Zones in the left pane, the right pane contains a Type column that displays the zone type for each zone. 13.3.3.2 Using a command-line interfaceWhen using the /enumzones switch without any more parameters, it displays all zones on the server. 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> 13.3.3.3 Using VBScriptA WQL query was used to find all MicrosoftDNS_Zone objects. You can add additional criteria to the WQL Select statement to return a subset of zones supported on the server. 13.3.4 See AlsoMSDN: MicrosoftDNS_Zone |