11.5.1 ProblemYou want to list the subnet objects in Active Directory. 11.5.2 Solution11.5.2.1 Using a graphical user interface
11.5.2.2 Using a command-line interfaceThe following command will list all subnets: > dsquery subnet The following command will display the properties for a particular subnet. Replace <Subnet> with the subnet address and mask (e.g., 10.5.3.0/24): > dsget subnet "<Subnet>" 11.5.2.3 Using VBScript' This code lists all the subnets stored in Active Directory. set objRootDSE = GetObject("LDAP://RootDSE") set objSubnetsCont = GetObject("LDAP://cn=subnets,cn=sites," & _ objRootDSE.Get("configurationNamingContext") ) objSubnetsCont.Filter = Array("subnet") for each objSubnet in objSubnetsCont Wscript.Echo " " & objSubnet.Get("cn") next 11.5.3 DiscussionTo display the site that subnets are associated with, include the siteObject attribute as one of the attributes to return from the query. For example, the second to last line of the VBScript solution could be modified to return the site by using this code: Wscript.Echo " " & objSubnet.Get("cn") & " : " & objSubnet.Get("siteObject") 11.5.4 See AlsoMS KB 323349 (HOW TO: Configure Subnets in Windows Server 2003 Active Directory) |