1 out of 2 rated this helpful - Rate this topic

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.

ValueMeaning
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
wbemErrAccessDenied
2147749891 (0x80041003)

Current user does not have the permission to access the object.

wbemErrFailed
2147749889 (0x80041001)

Unspecified error.

wbemErrInvalidParameter
2147749896 (0x80041008)

A specified parameter is not valid.

wbemErrInvalidObjectPath
2147749946 (0x8004103A)

Specified path was not valid.

wbemErrNotFound
2147749890 (0x80041002)

Requested object could not be found.

wbemErrOutOfMemory
2147749894 (0x80041006)

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

Wbemdisp.tlb

DLL

Wbemdisp.dll

See also

SWbemObject

 

 

Send comments about this topic to Microsoft

Build date: 3/9/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ