SWbemServices.Get method
Applies to: desktop apps only
The Get method of the SWbemServices object retrieves an object, that is either a class definition or an instance, based on the object path. This method retrieves only objects from the namespace that is associated with the current SWbemServices object.
The method is called in the synchronous mode. For more information, see Calling a Method.
For an explanation of this syntax, see Document Conventions for the Scripting API.
Syntax
objWbemObject = .Get( _ [ ByVal strObjectPath ], _ [ ByVal iFlags ], _ [ ByVal objWbemNamedValueSet ] _ )
Parameters
- strObjectPath [optional]
-
String that contains the object path of the object to retrieve. If this value is empty, the empty object that is returned can become a new class. For more information, see Describing the Location of a WMI Object.
- iFlags [optional]
-
Integer that determines the behavior of the query. This parameter can accept the following values.
Value Meaning - wbemFlagUseAmendedQualifiers
- 131072 (0x20000)
Causes WMI to return class amendment data with the base class definition. For more information about amended qualifiers, see Localizing WMI Class Information.
- objWbemNamedValueSet [optional]
-
Typically, this is undefined. Otherwise, this is an SWbemNamedValueSet object whose elements represent the context information that can be used by the provider that is servicing the request. A provider that supports or requires such information must document the recognized value names, data type of the value, allowed values, and semantics.
Return value
If successful, this method returns an SWbemObject object that represents the requested object.
Error codes
Upon the completion of the Get method, the Err object may contain one of the error codes in the following table.
| Error (Name/Dec/Hex) | Meaning |
|---|---|
|
Current user does not have the permission to access the object. |
|
Unspecified error. |
|
A specified parameter is not valid. |
|
Specified path was not valid. |
|
Requested object could not be found. |
|
Not enough memory to complete the operation. |
Remarks
You can use this method to obtain singleton objects, such as __CIMOMIdentification, which contains version information about the WMI installation that is running.
You can examine the repository with a viewing tool such as CIM Studio to verify that the new class and instance appear. For an example of removing a class and instance from the repository, see SWbemServices.Delete or SWbemObject.Delete_.
Examples
For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Type library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/9/2012