' List Health Summary for Local SMS Sites
On Error Resume Next
Dim objSWbemServices
Dim ProviderLoc
Dim Location
Dim strSummarizerSiteStatus
Dim colSummarizerSiteStatus
Dim objSiteSummary
strSummarizerSiteStatus="SMS_SummarizerSiteStatus"
Set ProviderLoc = GetObject _
("winmgmts:{impersonationLevel=impersonate}!root/sms:SMS_ProviderLocation")
If Err.Number<>0 Then
Wscript.Echo "Couldn't get SMS Provider"
Wscript.Quit
End If
For Each Location In ProviderLoc.Instances_
If Location.ProviderForLocalSite = True Then
Set objSWbemServices = GetObject("winmgmts:" & Location.NamespacePath)
Exit For
End If
Next
'Get SMS_SummarizerSiteStatus
Set colSummarizerSiteStatus=objSWbemServices.InstancesOf(strSummarizerSiteStatus)
If Err.Number<>0 Then
Wscript.Echo "Couldn't get Site Summary"
Wscript.Quit
End If
For Each objSiteSummary In colSUmmarizerSiteStatus
wscript.echo "Site code:" + objSiteSummary.SiteCode
If objSiteSummary.Status=0 Then
Wscript.Echo "Site is healthy"
End If
If objSiteSummary.Status=1 Then
Wscript.Echo "There are warnings for this site"
End If
If objSiteSummary.Status=2 Then
Wscript.Echo "The site health is critical"
End If
Next