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

Describing the Location of a WMI Object

Conceptually similar to a Uniform Resource Locator (URL), a WMI object path is a string that uniquely identifies the namespace on a server, a class within a namespace, or instances of a class. An object path is hierarchical, and contains several elements that describe the location of the object in question. Like file paths, WMI object paths can be described in full or specified as a relative path.

For example, a specific instance of Win32_LogicalDisk may have the following path from the SWbemObject.Path_ property.

\\Machine1\root\cimv2:Win32_LogicalDisk.DeviceID="C:"

The following example shows the relative path to this instance, as seen by displaying the Relpath property of the SWbemObjectPath object returned by the call to SWbemObject.Path_.

Win32_LogicalDisk.DeviceID="A:"

Note that DeviceID is the key property of the Win32_LogicalDisk class.

C++

The following table lists object path types and the associated methods that require object paths.

Object path typeMethod
Namespace
IWbemServices::OpenNamespace
Class
IWbemServices::ExecMethod
IWbemServices::ExecMethodAsync
Class or Instance
IWbemServices::GetObject
IWbemServices::GetObjectAsync
Instance
IWbemServices::DeleteInstance
IWbemServices::DeleteInstanceAsync

 

Script

Object paths can be constructed in several ways:

  • Retrieve the property of a method that returns an SWbemObjectPath object.
  • Retrieve the SWbemObject.Path_ property.
  • Create a string variable that contains the object path.

The following table lists the scripting objects that require object paths.

Scripting objectMethod
SWbemServices
AssociatorsOf
AssociatorsOfAsync
Delete
DeleteAsync
ExecMethod
ExecMethodAsync
Get
GetAsync
ReferencesTo
ReferencesToAsync
SWbemObjectSet
Item

 

 

 

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