SMS 2003 SMS 2003 Site Server View an SMS Collection , WMI
' View an SMS Collection
On Error Resume Next
Dim objSWbemServices Dim ProviderLoc Dim Location Dim colQueryCollectionResults Dim ObjResult
Dim objQuery Dim colQueryResults
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 Collection
Set colQueryCollectionResults=objSWbemServices.ExecQuery _ ("SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='SMS00001'" )
If Err.Number<>0 Then Wscript.Echo "Couldn't get Collection" Wscript.Quit End If
'run query
Wscript.Echo "Collections" Wscript.Echo "----------------------------------" For Each objResult In colQueryCollectionResults Wscript.Echo " " + objResult.Name Next If colQueryCollectionResults.Count=0 Then Wscript.Echo " no query results" End If
|
VbsEdit includes all these samples!
Download Now!
Version 5.4.1 - This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit. The evaluation version never expires.
Home
Buy Now
HtaEdit
Support
Video
What's new ?
|