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.
The namespace of a WMI object is listed on the WMI reference page. For example, the location of most of the classes supported by the CIMWin32 WMI Providers are located in the \root\cimv2 namespace. The following PowerShell code describes a call to retrieve the Win32_ComputerSystem object on your local machine:
Get-WmiObject -Class Win32_ComputerSystem -Namespace "root\cimv2" -ComputerName "."
Note that DeviceID is the key property of the Win32_LogicalDisk class.
The following table lists object path types and the associated methods that require object paths.
|Object path type||Method|
|Class or Instance|
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.