Integration with WMI
Applies To: Windows Server 2003 R2
Another feature of WinRM in Windows Server 2003 R2 is a WMI plug-in that exposes Windows Management Instrumentation (WMI) classes, methods and properties to WinRM. To use WMI with WinRM, you must convert the WMI Common Information Model (CIM) namespace and class to a WS-Management Uniform Resource Identifier (URI). This topic introduces the steps involved in this conversion.
When accessing WMI classes via WS-Management, a URI is required. The URI consists of the URI prefix and the class to be accessed. Similarly, the URI prefix consists of a hard-coded portion and the CIM namespace. For example, in Windows Server 2003 R2, the URI prefix is:
This allows the URI prefix to be generated for any CIM namespace accessible via WMI. If, for example, the goal is to access the root\default namespace, the following URI prefix would be used:
|Notice that the URI uses forward slashes (/), while the CIM namespace uses backslashes (\).|
In Windows Server 2003 R2, the URI prefix when accessing WMI CIM classes in the root/cimv2 namespace is:
In Windows Server 2003 R2, the URI prefix when accessing the IPMI provider classes is:
You can also use the following URI to access the IPMI provider classes via WMI:
|The IPMI provider uses the root/hardware WMI namespace.|
Generating WMI URIs
Most WMI classes and operations are currently supported in the WinRM WMI plug-in. (Embedded objects are currently not supported.) Generating the URI for these classes is a fairly simple process. The following section illustrates the process used to generate these URIs.
When generating a URI to a WMI class, the URI is simply made up of the URI prefix (discussed in the previous section), followed by the WMI namespace and the class information:
To set the value of a property or to invoke a specific method, a URI such as the following would be used:
URI Generation Examples
This section illustrates some examples of getting WMI information via WS-Management. For these examples, the Win32_Service WMI class will be used.
Using WS-Management, WMI classes, methods and properties can be retrieved (Get), set (Put), listed (Enumerate), and executed (Invoke).
To enumerate the services within Win32_Service, for example, the following URI would be used:
To get the properties of a specific service within Win32_Service, the following URI would be used: