Export (0) Print
Expand All

Creating an Object Using VBScript

You can create an object for WMI in Visual Basic Scripting Edition (VBScript) by connecting to WMI and then calling CreateObject. The following table lists the methods in the Scripting API for WMI that support object creation.

InterfaceProgID
SWbemDateTime "WbemScripting.SwbemDateTime"
SWbemLocator "WbemScripting.SWbemLocator"
SWbemLastError "WbemScripting.SWbem.LastError"
SWbemObjectPath "WbemScripting.SWbemObjectPath"
SWbemNamedValueSet "WbemScripting.SWbemNamedValueSet"
SWbemRefresher "WbemScripting.SWbemRefresher"
SWbemSink "WbemScripting.SWbemSink"

 

The following procedure describes how to create a WMI object using VBScript.

Aa389744.wedge(en-us,VS.85).gifTo create a WMI object using VBScript

  1. Connect to WMI using either a moniker or an SWbemLocator object.

    For more information, see Creating a WMI Script.

  2. Make a call to the VBScript CreateObject method.

    The following code example shows how to create an object.

    
    Set locator = CreateObject("WbemScripting.SWbemLocator")
    
    

    If you use a moniker in Step 1, you do not need to call CreateObject again.

 

 

Show:
© 2014 Microsoft