The site summary information is held in instances of the SMS Provider class SMS_SiteDetailSummarizer. An instance of the class exists for a variety of time intervals. For a given time interval, the SMS_SiteDetailSummarizer instance contains such information as the number of error, warning, and information messages generated during the interval. It also provides the version of SMS installed and the percentage of free space available to the SMS database and the database transaction log file.
In the same way that a component state can be queried for a time interval, a Tally Interval is used to define the summary time for the site. The following example summarizes from the first day of the current month.
See the SMS 2003 SDK for a complete list of summary intervals.
Example
On Error Resume Next Dim objSWbemServices Dim ProviderLoc Dim Location Dim QueryID Dim objQuery Dim colQuerySiteDetailsResults Dim objResult 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 'Query site details since the 1st of the month. Set colQuerySiteDetailsResults=objSWbemServices.ExecQuery("SELECT * FROM SMS_SiteDetailSummarizer WHERE TallyInterval='000A470000284400'" ) If err.number<>0 Then wscript.echo "Couldn't get site details" wscript.quit End If 'Run query. wscript.echo "Site details" wscript.echo "------------" For Each objResult In colQuerySiteDetailsResults wscript.echo "Name " + objResult.SiteName + " Sitecode " + objResult.SiteCode wscript.echo "Version " +cstr(objResult.Version) Select Case objResult.Status Case 0 wscript.echo "Status OK" Case 1 wscript.echo "Status Warning" Case 2 wscript.echo "Status Critical" End Select wscript.echo "Errors " +cstr(objResult.Errors) wscript.echo "Warnings " + cstr (objResult.Warnings) wscript.echo "Database free " + cstr(objResult.DatabaseFree) + "%" wscript.echo "Log file free" + cstr(objResult.TransFree) + "%" wscript.echo Next If colQuerySiteDetailsResults.Count=0 Then wscript.echo " no query results" End If Set objSWbemServices=Nothing Set ProviderLoc=Nothing Set Location=Nothing Set objQuery=Nothing Set colQuerySiteDetailsResults=Nothing |
Compiling the Code
- Requires Windows 2000 Server SP2 or later.
- You must run this sample on an SMS 2003 site server.