about_WMI

Short description

Windows Management Instrumentation (WMI) uses the Common Information Model (CIM) to represent systems, applications, networks, devices, and other manageable components of the modern enterprise.

Long description

Windows Management Instrumentation (WMI) is Microsoft's implementation of Web-Based Enterprise Management (WBEM), the industry standard.

Classic WMI uses DCOM to communicate with networked devices to manage remote systems. Windows PowerShell 3.0 introduces a CIM provider model that uses WinRM to remove the dependency on DCOM. This CIM provider model also uses new WMI provider APIs that enable developers to write Windows PowerShell cmdlets in native code (C++).

Don't confuse WMI providers with Windows PowerShell providers. Many Windows features have an associated WMI provider that exposes their management capabilities. To get WMI providers, run a WMI query that gets instances of the __Provider WMI class, such as the following query.

Get-WmiObject -Class __Provider

THREE COMPONENTS OF WMI

The following three components of WMI interact with Windows PowerShell: Namespaces, Providers, and Classes.

WMI Namespaces organize WMI providers and WMI classes into groups of related components. In this way, they're similar to .NET Framework namespaces. Namespaces aren't physical locations, but are more like logical databases. All WMI namespaces are instances of the __Namespace system class. The default WMI namespace is root/cimv2 (since Microsoft Windows 2000). To use Windows PowerShell to get WMI namespaces in the current session, use a command with the following format.

Get-WmiObject -Class __Namespace

To get WMI namespaces in other namespaces, use the Namespace parameter to change the location of the search. The following command finds WMI namespaces that reside in the root/cimv2/Applications namespace.

Get-WmiObject -Class __Namespace -Namespace root/cimv2/applications

WMI namespaces are hierarchical. Therefore, obtaining a list of all namespaces on a particular system requires performing a recursive query starting at the root namespace.

WMI Providers expose information about Windows manageable objects. A provider retrieves data from a component, and passes that data through WMI to a management application, such as Windows PowerShell. Most WMI providers are dynamic providers, which means that they obtain the data dynamically when it's requested through the management application.

FINDING WMI CLASSES

In a default installation of Windows 8, there are more than 1,100 WMI classes in root/cimv2. With this many WMI classes, the challenge becomes identifying the appropriate WMI class to use to perform a specific task. Windows PowerShell 3.0 provides two ways to find WMI classes that are related to a specific topic.

For example,to find WMI classes in the root/cimv2 WMI namespace that are related to disks, you can use a query such as the one shown here.

Get-WmiObject -List *disk*

To find WMI classes that are related to memory, you might use a query such as the one shown here.

Get-WmiObject -List *memory*

The CIM cmdlets also provide the ability to discover WMI classes. To do this, use the Get-CimClass cmdlet. The command shown here lists WMI classes related to video.

Get-CimClass *video*

Tab expansion works when changing WMI namespaces, and therefore use of tab expansion makes sub-WMI namespaces easily discoverable. In the following example, the Get-CimClass cmdlet lists WMI classes related to power settings. To find it, type the root/cimv2 namespace and then press the Tab key several times until the power namespace appears. Here is the command:

Get-CimClass *power* -Namespace root/cimv2/power