This script displays the site boundaries for all SMS sites that report to the site where the script is run, including the boundaries for the site where the script is run.

Site assignment data is held in SMS_SCI_SiteAssignment.

For additional information about planning site boundaries, see Planning Site Boundaries and Roaming Boundaries.


Sub Level( parent, depth )
	Dim Sites
	Dim Site
	Dim Descr
	Dim Boundaries
	Dim i
	Set Sites = objSWbemServices.ExecQuery("Select * From SMS_Site Where ReportingSiteCode='"+parent+"'")
	For Each Site In Sites
	'Descriptive info for site.
	Descr=Left( SPACE( depth*3 ) & Site.SiteName + " ("+Site.SiteCode+") ", 29)
	Descr=Descr & SPACE(30-LEN(Descr))
	wscript.echo descr
		Set boundaries=objSWbemServices.Get("SMS_SCI_SiteAssignment.SiteCode='"+site.sitecode+"',Filetype=1,ItemName='Site Assignment',ItemType='Site Assignment'")
	For i=0 to ubound(boundaries.AssignDetails)
		Wscript.Echo space(len(descr)) & boundaries.AssignTypes(i) & ": " & boundaries.AssignDetails(i)
	Level Site.SiteCode, depth+1

End Sub

Dim Sitecode
Dim objSWbemLocator
Dim objSWbemServices

Sitecode = "SITECODE"

Set objSWbemLocator =  CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer( , "root\sms\site_" & sitecode )

Level "", 0

Compiling the Code

  • Requires Windows 2000 Server SP2 or later.

  • Requires an SMS 2003 Site Server.

See Also