Export (0) Print
Expand All
1 out of 8 rated this helpful - Rate this topic

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.

SWbemDateTime WbemScripting.SwbemDateTime (Windows XP only)
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.



Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.