VbsEdit, the award-winning VBScript editor that dramatically reduces the time you spend writing .VBS scripts

Sample scripts


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 version 3.4.1
Released Tuesday, January 06, 2009  -   The evaluation version never expires


Home   Buy Now   HtaEdit   Support   Video   What's new ?   Awards

Copyright (C) 2001-2009 Adersoft