Retrieving an Instance
Retrieving an instance is one of the most common retrieval procedures you are likely to perform in WMI. You can retrieve an existing instance or create a new unnamed instance. The WMI path to the existing instance is a required parameter. For more information, see Describing the Location of a WMI Object.
Note When providing an instance, a provider may be unable to provide a value for certain properties. Unless otherwise stated in the property description, you cannot infer any meaning from an empty value. This is not to be confused with a string which has a NULL value. In this case, the value is populated. It is empty but has a value: NULL.
Retrieve a local copy of the instance with a call to the VBScript GetObject method.
To retrieve an instance of a WMI class using VBScript
- Call GetObject with the object path of the instance as shown in the following example.
Retrieving a specific instance requires giving a name as part of the object path.
In C++, call IWbemServices::GetObject.
To retrieve an instance of a WMI class using C++
- Retrieve a local copy of the instance with a call to
IWbemServices::GetObjectAsync. The WMI path to the object must be included.
As the name implies, GetObjectAsync retrieves the instance asynchronously, while GetObject retrieves the instance synchronously. If you want to use asynchronous retrieval, you must implement the IWbemObjectSink interface.