Windows Management Instrumentation Tester (WBEMTest)

Windows Management Instrumentation Tester, also called WBEMTest, is a general-purpose utility for viewing or modifying Common Information Model (CIM) classes, instances, or methods during the development of Windows Management Instrumentation (WMI) providers and WMI applications. WBEMTest can also be used for troubleshooting WMI or programs that depend on WMI.

Note

  • Although Microsoft provides this documentation to assist you in using WBEMTest, the tool is primarily intended for use by Microsoft Product Support Services.

Use WBEMTest to perform the following tasks:

  • Create, enumerate, and delete CIM classes and instances
  • Execute methods
  • Run queries
  • Display the Managed Object Format (MOF) code for classes and instances.

Because WBEMTest acts as a front-end to the COM API for WMI, you can also use WBEMTest to check queries, classes, and instances when developing WMI providers and WMI client applications.

For more information, see COM API for WMI. (http://www.microsoft.com/)

The executable file for WBEMTest, Wbemtest.exe, is installed in the WBEM directory of your Windows system directory. On Windows XP systems, this is the %windir%\system32\Wbem folder.

Related Topics


The WBEMTest User Interface

Two dialog boxes comprise the primary interface to WBEMTest functions.
  • The Windows Management Instrumentation Tester dialog box is displayed when you click Start, click Run, and then type wbemtest.exe in the Open: field. This dialog box provides access to all WBEMTest functions.
  • The Connect dialog box enables you to log on to WMI and connect to a namespace.

For more information on other WBEMTest dialog boxes, see individual tasks in Using WBEMTest.


Windows Management Instrumentation Tester Dialog Box

The Windows Management Instrumentation Tester dialog box is the user interface for the WBEMTest utility. The first time you see this dialog box, most of the buttons are disabled. After you connect to WMI, this dialog box is displayed with all buttons enabled.

Note

You must select the Enable All Privileges check box in the Method Invocation Options section before you click Connect if you want to be able to debug or reboot after you are connected to WMI.

After you have connected to WMI, you can perform the following actions from this dialog box:

  • Enumerate, create, open, and delete classes
  • Enumerate, create, open, and delete instances
  • Open namespaces
  • Execute queries
  • Execute the methods of classes
  • Create refreshers

The Method Invocation Options section presents options for customizing the way methods are invoked and output is presented. You can invoke a method in one of three ways:

  • Select the Asynchronous check box to perform actions asynchronously. If you are performing tasks, such as complex queries, that take a long time to execute, asynchronous operations allow WBEMTest to perform other actions at the same time.
  • Select the Synchronous check box to perform actions synchronously.
  • Select the Semisynchronous check box to perform actions semisynchronously. This is the default value. If you select the Use NextAsync (enum. only) check box, you cannot also specify a Timeout value. Use the Batch Count (enum. only) field to specify how many enumerated items are displayed at a time in the Query Result dialog box.

For more information about asynchronous calls see Making an Asynchronous Call in the WMI SDK documentation that is part of the Platform SDK in MSDN.

You can click Edit Context to set up a context object. With context objects, you can define properties and values for properties that some providers use as an additional source of information.

For more information about context objects, see IWbemContext. (http://www.microsoft.com/)


Connect Dialog Box

Before you can use the functions of WBEMTest, you must log on to WMI. Click Connect on the Windows Management Instrumentation Tester dialog box to log on to WMI. The Connect dialog box appears.

You can generally accept the default settings displayed on the Connect dialog box. The fields of the Connect dialog box are described below.

  • The Namespace field displays the default namespace for your computer. You can specify a different namespace on your computer or on another computer. For example, for access to the classes of the Win32 provider, you could specify root\cimv2. If you wanted to access the cimv2 namespace on a remote computer named myserver, you could specify \\myserver\root\cimv2. To access remote computers, you must grant permission to read or write from the remote computer using the WMI Control application, Wbemcntl.exe.
  • The Connection: fields specify properties of the connection to WMI. The Using: field specifies that IWbemLocator is used for obtaining the initial namespace pointer to Windows Management on a particular host computer. The Returning: field specifies that a IWbemServices pointer is used for accessing Windows Management information. The Completion field specifies that processing is synchronous.
  • The Credentials fields enable you to specify a user name, password, and authority. You can log on to WMI as a different user, using credentials that are different from those of the user who is currently logged on. If you leave these fields blank, WMI uses the settings from the current Windows logon.
  • The Locale field enables you to specify a different locale by entering a localization code. If you want to use the current locale, leave this field blank. If this field is not blank, it must contain a string that indicates the desired locale from which information should be retrieved. For Microsoft locale identifiers, the format of the string is "MS_xxxx", where xxx is a string in hexadecimal form that indicates the LCID. For example, American English would appear as "MS_409".
  • The How to interpret empty password option buttons control what happens if you leave the password field blank. WMI processes a blank password differently from no password at all. The default value for this field is NULL and causes WBEMTest to use the current Windows password to connect to WMI. If you need to log on to WMI using an empty password, you should select the Blank option button.
  • The Impersonation level option buttons enable you to set the distributed COM (DCOM) impersonation level that WBEMTest should use. In most cases, you can use the default value, Impersonate,for this option button. However, some providers might require specific impersonation settings. Consult the documentation for the provider you are using if you are not sure which value to use. Additionally, the impersonation level that you specify must be applicable to the operating system that you are using. For example, if you specify an impersonation level of Delegate and WBEMTest is not running on a computer that uses the Windows XP Home Edition or Windows XP Professional operating system, this setting is ignored.

    For more information about impersonation, see Setting the DCOM Impersonation Level for the Scripting API. (http://www.microsoft.com/)

  • The Authentication level option buttons enable you to specify the distributed COM (DCOM) authentication level to be used. These authentication levels control how information is authenticated by DCOM. Generally, you can use Packet, the default value for this option button.


Object Editor Dialog Box

The Object Editor dialog box appears when you double-click a class or instance from the Query Result dialog box. The Object Editor dialog box also appears when you click Open Class or Enum Class on the Windows Management Instrumentation Tester dialog box.

You can use the Object Editor dialog box to:

  • Edit the qualifiers, properties, and methods for the selected class or instance.
  • View the MOF code that creates the class or instance.
  • View instances of the class, the derived classes, and the superclass of the class, if you are editing a class definition.
  • Refresh the view of the object after you make changes.

For example, when you click Open Class on the Windows Management Instrumentation Tester dialog box and type Win32_LogicalDisk in the Get Class Name dialog box, the Object Editor for Win32_LogicalDisk dialog box appears.

If you double-click any of the items in the list boxes, the appropriate editor will open for that object. For example, if you double-click the reset method in the methods list box, the method editor for the reset method appears.


Object Editor Qualifier, Property, and Method Functions

The qualifier, property, and method functions for the Object Editor are as shown below:

  • Click Add Qualifier to open the Qualifier Editor dialog box. You can use this feature to add qualifiers that apply to the class or instance as a whole as opposed to a specific property of the class or instance. Type in the values for the new qualifier and click Save Qualifier to create the new qualifier.
  • Click Edit Qualifier to open the Qualifier Editor dialog box for the qualifier that is selected. You can use this to change the value or flavors assigned to a qualifier.
  • Click Delete Qualifier to delete the currently selected qualifier.
  • Click Hide System Properties and system properties do not show in the Object Editor dialog box.
  • Click Add Property to define new properties and assign values to classes or instances. When you click Add Property, the Property Editor dialog box appears.
  • Click Edit Property to change the definition for the currently selected property.
  • Click Delete Property to delete the currently selected qualifier.
  • Click Add Method to define the methods for a class or instance. When you click Add Method, the Method Editor dialog box appears.
  • Click Edit method to edit the methods for a class or instance. When you click Edit Method, the Method Editor dialog box appears.
  • Click Delete Method to delete the currently selected method.


Other Object Editor dialog box functions

The following buttons also appear on the Object Editor dialog box:

  • Click Close to close the Object Editor dialog box.
  • Click Save Object to save the changes to the current class or instance.
  • Click Show MOF to open the MOF dialog box, which contains the managed object format (MOF) code that you can use to construct the current object. It is important to remember that the MOF code shown in this dialog box might not be identical to the actual MOF code that created the class or instance. The original MOF file might have had comments and different formatting than this text shows. For more information. see Managed Object Format (MOF) Language (http://www.microsoft.com/)
  • Click Superclass to run a schema query that shows the class from which the current class or instance is derived.
  • Click Derived to run a schema query that shows the child classes of the current class or instance.
  • Click Instances to show instances of the current class.
  • Use the Update type option buttons to control how the class are updated. The following tables describe two groups of option buttons that control the update process.
Update Type | Meaning
Create only | Used for creation only. The save operation fails if the class or instance already exists.
Update only | Causes this call to update. The class or instance must exist for the save operation to be successful.
Either | Causes the class or instance to be created if it does not exist, or overwritten if it exists already.

Update Type | Meaning
Compatible | Allows a class to be updated if there are no derived classes and there are no instances for that class. It also allows updates in all cases if the change is just to unimportant qualifiers, for example, the description qualifier. This is the default value for this option button and is used for compatibility with previous versions of WMI. If the class has instances, the update fails.
Safe | Allows updates of classes even when there are child classes, provided the change does not cause any conflicts with child classes. An example of an update to this value is adding to the base class a new property that was not previously mentioned in any of the child classes. If the class has instances, the update fails.
Force | Forces updates of classes when conflicting child classes exist. For example, this value forces an update if a class qualifier was defined in a child class, and the base class tries to add the same qualifier in conflict with the existing one. In force mode, this conflict is resolved by deleting the conflicting qualifier in the child class. If the class has instances, the update fails.


Get Object Path Dialog Box

You can use the Get Object Path dialog box to specify the name of a class or the relative path to a class instance.

Object paths have the format: [Class].[KeyProperty] = Value

For example, if you have an instance of a class called Myclass that has a key property called Keyproperty with a value of "A" the object path would be: MyClass.KeyProperty="A".

For more information, see Object Paths. (http://www.microsoft.com/)


Get Class Name Dialog Box

Use the Get Class Name dialog box to specify class names for the WBEMTest Open Class function.


Superclass Info Dialog Box

The Enum Classes function uses the Superclass Info dialog box. If you select the Recursive option button, WBEMTest also enumerates all of the subclasses of the class you specify, as opposed to only the immediate subclasses of that class.


Query Dialog Box

Use the Query dialog box to compose a query and then execute it. To display the Query dialog box, click Query on the Windows Management Instrumentation Tester dialog box.

Type the WBEMTest query in the Enter Query text box.

In the Query Type list box, you can select a query language. Currently, only Windows Management Instrumentation (WMI) Query Language (WQL) is supported.

You can use the Retrieve class prototype check box to indicate that you do not want instances from this query and to return the class that the instances would belong to if they were returned.

For more information, see Using Queries. (http://www.microsoft.com/)


Query Result Dialog Box

The Query Result dialog box is displayed when you perform a function that enumerates classes or instances. This dialog box also appears for event notification queries to display events. For asynchronous event notification queries, this dialog box displays the events as they are received. New events are delivered automatically when you are running a semisynchronous event notification query.

If the query results are instances, the relative path for the instances is displayed. You can double-click any of the objects in the Query Result dialog box to display the Object Editor dialog box for that object.


Class Info Dialog Box

Use the Class Info dialog box to specify the name of the class for which you want to see instances. This dialog box appears when you click Enum Instances on the Windows Management Instrumentation Tester dialog box. If you select Immediate Only, the default value, only instances of the class you specify will be displayed. If you select Recursive, instances of the subclasses of the class you specify will be displayed.


Execute Method Dialog Box

You can use the Execute Method dialog box to run a method of a class or class instance. To display the Execute Method dialog box, click Execute Method on the Windows Management Instrumentation Tester dialog box.

There are several parts to the Execute Method dialog box:

  • Click Edit Object Path to edit the object path. You can set the object path to refer to a specific instance if necessary.
  • The Object Path text box shows the current object path.
  • Click Dismiss to close this dialog box without executing the method.
  • The Method drop-down list displays the methods available for this class.
  • Click Edit In Parameters to set the various parameters the method might require.
  • Click Clear In Parameters to reset all the input parameters to the default settings.
  • Click Edit Out Parameters to view the output parameters for the method. The output parameters contain data returned from a method.


Property Editor Dialog Box

Use the Property Editor dialog box to create or edit properties of classes. In some cases, for example, when you edit an existing class, you might not be able to set all the fields on this dialog box.

The following steps describe how to add or edit a property.

To add or edit a property

  1. Enter the name of a new property in Property Name. You cannot change the name of existing properties.
  2. The name of the parent class of the current class or instance is displayed in Class of origin. You cannot change the Class of origin field.
  3. Specify the data type of the data stored in the property. For example, if the property is to store string data you should specify CIM_STRING. Examples of valid CIM types are shown in the table below.
  4. Select the Array check box if this property is to contain an array of objects of the type you declare.
  5. Define a value for the property in the Value box. This value is the default value if this is a property of a class.
  6. Select standard qualifiers in the Qualifiers section by clicking the associated option button. For example, to specify this property as a key property, click Key to add the key qualifier to the class. You can also add, delete, and edit other qualifiers using Add Qualifier, Delete Qualifier, and Edit Qualifier.
  7. Click Save Property to update this property.

The following table shows valid CIM types you can select in the Type box.

CIM Type | Type of data stored
CIM_SINT8 | 8-bit signed integer
CIM_UINT8 | 8-bit unsigned integer
CIM_SINT16 | 16-bit signed integer
CIM_UINT16 | 16-bit unsigned integer
CIM_SINT32 | 32-bit signed integer
CIM_UINT32 | 32-bit unsigned integer
CIM_SINT64 | 64-bit signed integer
CIM_UINT64 | 64-bit unsigned integer
CIM_REAL32 | 32-bit real number
CIM_REAL64 | 64-bit real number
CIM_BOOLEAN | BOOLEAN value
CIM_STRING | String
CIM_DATETIME | Date and Time
CIM_REFERENCE | Reference object
CIM_CHAR16 | Character
CIM_OBJECT | CIM object


Qualifier Editor Dialog Box

You can define the name, data type, flavor, and value of a qualifier in the Qualifier Editor dialog box.

You can assign five common qualifier flavors to your qualifier by selecting the check boxes in the flavor section. The following flavors are available:

  • Propagates to instances
  • Propagates to derived classes
  • Allows overrides
  • Propagated
  • Amended

For more information, see WMI-Specific Qualifiers (http://www.microsoft.com/) and Qualifier Flavors. (http://www.microsoft.com/)


Method Editor Dialog Box

You can use the Method Editor dialog box to add and methods to classes and class instances, and to edit methods.

The Method Editor dialog box contains the following:

  • Enable the Edit Input Arguments button by clicking the Enable Input Args option button.

    Click the Edit Input Arguments button to open the Object Editor dialog box for an instance of the __Parameters class. You can use the object editor to edit or define new input parameters for a method.

  • Enable the Edit Output Arguments button by clicking the Enable Output Args option button.

    Click the Edit Output Arguments button to display the Object Editor dialog box for an instance of the __Parameters class. You can use the object editor to edit or define new output parameters for a method.

  • Add, delete, and edit the qualifiers for this method in the Qualifiers section.
  • Click Save Method to save new methods and update existing methods.


Query Result - REFRESHER Dialog Box

You can use the Query Result - REFRESHER dialog box to add objects or enumerators to a refresher, and to delete objects or enumerators from a refresher. To display the Query Result - REFRESHER dialog box, click Create Refresher on the Windows Management Instrumentation Tester dialog box.

The Query Result - REFRESHER dialog box contains the following:

  • Click Add to display the Get Object For Refresher dialog box.
  • Type the name of a class that supports refreshers to add a refresher.
  • Delete refreshers by clicking Delete.
  • Click Refresh to populate the instances with data.

Note

  • The refreshers you create are empty until you click Refresh. Click Refresh as often as necessary to update the data in your refreshers.


Get Object For Refresher Dialog Box

You can use the Get Object For Refresher dialog box to specify the object path to an instance you are adding to your refresher, or to specify the Class name of the enumerator you want to add to your refresher. To display the Get Object For Refresher dialog box, click Add on the Query Result - REFRESHER dialog box.

The Get Object For Refresher dialog box contains the following:

  • Type the relative path to an instance and click Add Object if you are refreshing an object.
  • Type the class name of your refresher and click Add Enum if you are refreshing an enumerator.


MOF Dialog Box

The MOF dialog box appears when you click Show MOF on the Object Editor dialog box. You can use the MOF dialog box to display Managed Object Format (MOF) code when editing a class or class instance in the Object Editor dialog box.


Using WBEMTEST

This section shows how to connect to WMI from WBEMTest, use the WBEMTest class and instance functions, open a namespace, execute methods, create a query, and create a refresher.

Notes

  • You can find a description of the dialog box used for a specific task by clicking on the Related Topics link for each topic.
  • For definitions of unfamiliar words, see the WMI Glossary. (http://www.microsoft.com/)


Connecting to WMI with WBEMTest

When you start WBEMTest, the Windows Management Instrumentation Tester dialog box appears. Before you can use WBEMTest functions, you must log on to WMI.

Note

The online help procedures use the root\cimv2 namespace. To step through the procedures, you must be connected to this namespace instead of the default namespace.

To log on to WMI

  1. Click Start, click Run, and then type wbemtest.exe in the Open: field.
  2. Click Connect on the Windows Management Instrumentation Tester dialog box. Note that most of the controls on this dialog box are disabled. After you are logged on to WMI, these controls are enabled.
  3. In the Namespace field on the Connect dialog box, type the path to the namespace to which you want to log on.

    For example, type root\cimv2 to connect to the namespace where the Win32 provider classes reside. The Connect dialog box has options you can set, but in most cases you can use the default settings.

  4. Click Connect on the Connect dialog box.

    The namespace you connected to is displayed in the upper left corner of the Windows Management Instrumentation Tester dialog box, and the buttons on this dialog box are now active.


Enumerating Classes with WBEMTest

You can display the child classes of a superclass by clicking Enum Classes on the Windows Management Instrumentation Tester dialog box.

To enumerate classes

  1. Click Enum Classes.

    The Superclass Info dialog box appears.

  2. Type the name of the superclass if you want to enumerate the child classes of a specific class. For example, you might specify "Cim_StorageExtent" as the superclass. To see all the top level classes for the current namespace, leave the Superclass Info dialog box empty and select the Immediate only option button. If you want to see all the classes in a namespace, leave the Superclass Info dialog box empty and select the Recursive option button. When you select the Recursive option button, subclasses of the superclass, and all the subclasses of those subclasses, will appear. If you select the Immediate only option, only the immediate subclasses of the superclass you specify will appear.
  3. Click OK. The Query Result dialog box appears containing the subclass of the superclass you specified.


Creating a Class with WBEMTest

You can create a new class definition in the current namespace by clicking Create Class on the Windows Management Instrumentation Tester dialog box.

Note

To use this example, be sure that you are logged in to the root\cimv2 namespace.

To create a new class

  1. Click Create Class.

    The Optional Superclass dialog box appears.

  2. If you are creating a new base class, leave this dialog box empty.
  3. If you are specifying an existing class definition, the new class is based on the current namespace.

    For example, if you specify Win32_LogicalDisk as the superclass, the new child class inherits the properties of the Win32_LogicalDisk class.

  4. Click Continue.

    The Object Editor dialog box appears.

  5. Select the __Class property.
  6. Select Edit Property.

    The Property Editor dialog box appears.

  7. Click Not Null and type the name for the new class in the text box.
  8. Click Save Property.

    The Object Editor dialog box appears.

  9. Define the properties, qualifiers, and methods for the new class.
  10. Click Save Object to create the new class.

For more information on defining properties, qualifiers and methods for a class, see Object Editor Dialog Box.


Opening Classes with WBEMTest

You can edit properties, qualifiers, and methods for the class you specify with the Open Class button on the Windows Management Instrumentation Tester dialog box.

The following steps show how to open a class using WBEMTest.

To open a class

  1. Click Open Class on the Windows Management Instrumentation Tester dialog box.

    The Get Class Name dialog box appears.

  2. Type the name of the class you want to open, and then click OK.

    The object editor for the class you specified appears.

  3. Click Save Object in the Object Editor dialog box to save the changes to the class.


Deleting Classes with WBEMTest

You can delete a class in the current namespace with the Delete Class button on the Windows Management Instrumentation Tester dialog box.

The following steps describe how to delete a class using WBEMTest.

To delete a class

  1. Click Delete Class on the Windows Management Instrumentation Tester dialog box.

    The Get Class Name dialog box appears.

  2. Type the name of the class you want to delete and click OK.

    A dialog box is displayed to warn you that the class might have derived classes or instances. This dialog box is displayed even if there are no derived classes or instances.

  3. If you are sure you want to delete the class, click Yes to delete the class.


Enumerating Instances with WBEMTest

You can enumerate the instances of a class with the Enum Instances button on the Windows Management Instrumentation Tester dialog box.

To enumerate instances of a class

  1. Click Enum Instances on the Windows Management Instrumentation Tester dialog box.

    The Class Info dialog box appears.

  2. Type the name of the class for which you want to see instances.
  3. If you want to see instances of the derived classes of the superclass you specify, click the recursive option button.
  4. If you want to see only the immediate instances of the class you specify, click the immediate option button. Click OK.

    5. The Query Result dialog box appears. The relative path for each of the instances is displayed in the query result dialog box.

  5. Double-click any of the instances listed in the Query Result dialog box to display the Object Editor dialog box for that instance.


Creating an Instance with WBEMTest

You can create a new instance of a class in the current namespace with the Create Instance button on the Windows Management Instrumentation Tester dialog box.

The following steps describe how to create an instance of a class.

To create an instance of a class

  1. Click Create Instance on the Windows Management Instrumentation Tester dialog box.

    The Create Instance dialog box appears.

  2. Type the name of a class in the Enter class name: field.
  3. Choose either Use IWbemclassObject::SpawnInstance to create a new instance from the current class or Use IWbemService::GetObject to retrieve an object from the namespace associated with the current IWbemServices object, and then click OK.

    The Instance Of dialog box appears. This dialog box is almost identical to the Object Editor dialog box. Use the Instance Of dialog box to set properties for the new instance.

  4. Set the values of the properties for your new instance by clicking Edit Property on the Instance Of dialog box.

    If the instance you are creating has key properties, set them to an appropriate value before you save the instance.

    If you do not assign a value for the key property, a globally unique identifier (GUID) is assigned to the key property by default.

  5. Click Save Object to create the new instance.


Opening an Instance with WBEMTest

You can open an instance of a class with the Open Instance button on the Windows Management Instrumentation Tester dialog box.

To open an instance of a class

  1. Click Open Instance on the Windows Management Instrumentation Tester dialog box.

    The Get Object Path dialog box appears.

  2. Type the relative object path for the instance you want to retrieve.

    For example, if you want to open an instance of the Win32_LogicalDisk class, type Win32_LogicalDisk.DeviceID="C:".

  3. Click OK.

    The Object Editor dialog box for the instance appears. You can use the Object Editor dialog box to view or edit the class instance you have opened.


Deleting an Instance with WBEMTest

You can delete an instance of a class with the Delete Instance button on the Windows Management Instrumentation Tester dialog box.

To delete an instance of a class

  1. Click Delete Instance on the Windows Management Instrumentation Tester dialog box.

    The Get Object Path dialog box appears.

  2. Type the relative object path for the instance you want to delete.

    For example, to delete an instance of MyClass where the key property is F122, type MyClass.KeyProperty="F122".

  3. Click OK to delete the instance.

Note

  • You cannot delete dynamic instances of static classes unless the provider supports this capability. For example, if you attempt to delete an instance of Win32_Process, a "Provider Not Capable" error appears, because the provider does not support the deletion of dynamic instances.


Opening a Namespace with WBEMTest

You can open a namespace within the namespace to which you are currently logged on with the Open Namespace button on the Windows Management Instrumentation Tester dialog box.

The following steps describe how to open a namespace using WBEMTest.

To open a namespace

  1. Click Open Namespace on the main WBEMTest dialog box.

    The Get Object Path dialog box appears.

  2. In the Object Path text box, type the name of a namespace that is contained within the current namespace, and then click OK.

    For example, type cimv2 if you are already logged on to the root namespace.

If the logon is successful, the namespace field on the WBEMTest main dialog box is updated to show the new active namespace.

Notes

  • The Open Namespace button opens only those namespaces that are inside the current active namespace.
  • You cannot move to a namespace that is closer to the root namespace than the current namespace. For example, if your current active namespace is root\cimv2, you cannot use the Open Namespace button to move to the root namespace. You must log on to WMI again to connect to other namespaces.


Executing Class and Data Queries

You can execute class (schema) and data queries with the Query button on the Windows Management Instrumentation Tester dialog box.

To execute a query

  1. Click Query on the Windows Management Instrumentation Tester dialog box.

    The Query dialog box appears.

  2. In the Enter Query box, type your query.

    The following example shows a query that checks for instances of Win32_Logicaldisk that have a device ID of "C:" or "D:" and have at least 560 MB of disk space available:

    SELECT * FROM Win32_LogicalDisk WHERE (Name = "C:" OR Name = "D:") AND FreeSpace > 560000000
  3. If you want to see only the class definition, select the Retrieve class prototype check box.

    If you do not select the Retrieve class prototype check box, instances are returned unless you construct a schema query.

  4. Click Apply to execute the query.

    The Query Result dialog box appears. WBEMTest attempts to return class instances based on the criteria you specify.

Note

  • You can create data and schema queries with the query option. However, you cannot create event notification queries with the query option.

For more information, see Executing a Notification Query with WBEMTest, WMI Query Language, and (http://www.microsoft.com/) and Schema Queries. (http://www.microsoft.com/)

.


Executing a Notification Query with WBEMTest

You can query for event notifications with the Notification Query button on the Windows Management Instrumentation Tester dialog box.

The following steps describe how to run an event notification query using WBEMTest.

To run an event notification query

  1. Click Notification Query on the Windows Management Instrumentation Tester dialog box.

    The Query dialog box appears.

  2. In the Enter Query box, type an event notification query.

    The following is an example of an event query that notifies you when a log event occurs.

    SELECT * FROM __instancecreationevent WHERE TargetInstance ISA 'Win32_NTLogEvent'
  3. Click Apply.

    The Query Result dialog box appears. The words Operation in Progress appear in the lower-right corner, indicating that WMI is processing your query. Because event notification queries are never complete, the Operation in Progress status message is displayed on the Query Result dialog box until you stop the query.

  4. For event notification queries that are running semisynchronously, you must specify batch count and time-out values. These values determine how events are extracted from the enumerator.
  5. If your event notification query is running asynchronously, events are displayed in the Query Result dialog box as the events are received.

    If you want to view an event notification, double-click the event in the Query Result dialog box. The Instance Of dialog box appears.

  6. Click Close to stop the query.

Note

  • If you want your event notification query to run asynchronously, select the Execute asynchronously check box on the Windows Management Instrumentation Tester dialog box.

For more information, see Making an Asynchronous Call. (http://www.microsoft.com/)

For more information, see Event Notification. (http://www.microsoft.com/)


Executing a Method with WBEMTest

You can execute the methods of classes or class instances with the Execute Method button on the Windows Management Instrumentation Tester dialog box.

The following steps show how to execute the Create method for the Win32_Process class of the Win32 Provider.

To execute a method of a class instance

  1. Click Execute Method on the Windows Management Instrumentation Tester dialog box.

    The Get Object Path dialog box appears.

  2. If the method you are executing applies to a specific instance, type the relative path to the specific instance of that class, for example, ..\Win32_Process\ProcessX.
  3. If the method applies to the class in general, type only the class name, for example, Win32_Process. Click OK.

    4. The Execute Method dialog box appears.

  4. Select the name of the method you want to edit from the list in the Method box.
  5. Click Edit In Parameters to set the input parameters for the Create method.

    The Object Editor dialog box appears. Most methods require specific input parameters to execute correctly. The properties that you need to set depend on the method you are executing. In this example, the method to be executed requires only that the commandline parameter be set to the name of the process to be created.

  6. Click the CommandLine property and click Edit Property.

    WBEMTest creates an instance of the __Parameters class and opens the Object Editor dialog box for this object. The properties of the __Parameters object define the in parameters for the method.

  7. Click the CommandLine property to select it.

    Note

    In this example, a CommandLine property exists for this class. However, many classes do not have this property.

  8. Click Edit Property.

    The Property Editor dialog box appears.

  9. Select the Not NULL option button and type the name of the executable to launch as a new process.

    For example, you can type calc.exe if you want the new process to be the Windows calculator.

  10. Click Save Property when you are done setting up the in parameters. The Execute Method dialog box appears.
  11. Click Execute to run the method.

    In this example, an instance of the Windows calculator starts on your computer.

    12. If the method is successful, a dialog box displays the message Method executed successfully.

  12. Click Edit Out Parameters to see the out parameters of the Create method.

WMI creates an instance of the __Parameter class that you can examine to see the result code of the method returned. If the method did not execute successfully, you can determine the error code by examining the value of the ReturnValue property. Some methods return the data as values of properties of the __Parameter instance. The Create method returns the process ID of the new process in a property called ProcessId.


Creating a Refresher with WBEMTest

A refresher is a container that encapsulates objects and other refreshers that need to be refreshed. Refreshers allow providers to deliver information at a very high rate. Because refreshers are an in-process DLL to the client applications, or an in-process DLL to WMI in the case of remote providers, they can deliver management information more quickly than standard providers.

You can use WBEMTest to create a refresher for any object in Windows XP. The Performance Counter Provider is an example of a standard provider that supports refreshers. If your operating system is Windows XP, you probably already have this provider installed.

The following steps describe how to use WBEMTest to create a refresher.

To create a refresher using WBEMTest

  1. Click Create Refresher in the Windows Management Instrumentation Tester dialog box.

    The Query Result - REFRESHER dialog box appears.

  2. Click Add to add a new refresher.

    The Get Object For Refresher dialog box appears.

  3. Type the name of the class or the path to the instance of which your refresher is part in the Object Path box.

    If your system has the Performance Counters Provider installed and you are logged on to the root\cimv2 namespace, you can create a refresher for the Win32_PerfRawData_PerfProc_Process class.

  4. Click Add Enum to add an enumerator of all instances of Win32_PerfRawData_PerfProc_Process (all processes) on your system.

    The refresher dialog box appears with the new refresher in the list.

  5. Click Refresh to populate the refresher.
  6. Double-click the enumerator.

    The Query Result dialog box appears.

For more information, see System Provider. (http://www.microsoft.com/)


Topic Not Found

No matching topic was found. Some possible reasons and remedies are as follows:

  • The file (.chm) that contains the destination topic is not in the expected location.

    Remedy: Rerun the MSDN Library Setup.

  • The file (.chm) that contains the current topic or destination topic is out-of-date and the link is no longer valid.

    Remedy: Install the latest version of the MSDN Library.

  • The MSDN Library CD is not in the CD-ROM drive.

    Remedy: Insert the MSDN Library CD into the CD-ROM drive.

Built on Wednesday, July 28, 1999


WBEMTest Dialog Boxes

This section shows some of the dialog boxes that are used by WBEMTest.