Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
March 12, 2006
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," & strConfigurationNCSet objSite = GetObject(strSitePath)objSite.GetInfoEx Array("siteObjectBL"), 0arrSiteObjectBL = objSite.GetEx("siteObjectBL")For Each strSiteObjectBL In arrSiteObjectBL WScript.Echo Split(Split(strSiteObjectBL, ",")(0), "=")(1)Next
The sample command
D:Temp>cscript listsubnets.vbs Dallasproduces the following output:192.168.2.0/24192.168.1.0/24
You May Also Like