A. The following script, which you can download here, takes as its first argument the name of a site and returns all the subnets for the given site:
strSiteRDN = "cn=" & WScript.Arguments(0) Set objRootDSE = GetObject("LDAP://RootDSE") strConfigurationNC = objRootDSE.Get("configurationNamingContext") strSitePath = "LDAP://" & strSiteRDN & ",cn=Sites," & strConfigurationNC Set objSite = GetObject(strSitePath) objSite.GetInfoEx Array("siteObjectBL"), 0 arrSiteObjectBL = objSite.GetEx("siteObjectBL") For Each strSiteObjectBL In arrSiteObjectBL WScript.Echo Split(Split(strSiteObjectBL, ",")(0), "=")(1) NextThe sample command
D:\Temp>cscript listsubnets.vbs Dallas produces the following output: 192.168.2.0/24 192.168.1.0/24
0 comments
Hide comments