WMI is a Windows management infrastructure, not a scripting language. Scripts and applications use it to query system information, call management operations, or receive events exposed by WMI providers. For new PowerShell scripts, use CIM cmdlets such as Get-CimInstance; reserve older WMI cmdlets for maintaining Windows PowerShell scripts.
What WMI does
Windows Management Instrumentation (WMI) is Microsoft’s implementation of Web-Based Enterprise Management (WBEM), using the Common Information Model (CIM) to represent managed systems and components. A script or application acts as a consumer: it asks WMI for management information or an operation. WMI connects that request to a provider, which exposes the data and operations for a particular area of Windows. The WMI service and repository help organize and serve that information. Microsoft’s overview of WMI and its WMI architecture documentation describe these roles.
The repository contains class definitions and other static information, while providers often retrieve requested values dynamically. As a result, what you can read or do depends on the provider and the class—not on a universal set of capabilities guaranteed by WMI.
Choose a scripting interface
| Approach | Best fit | Important distinction |
|---|---|---|
| PowerShell CIM cmdlets | New PowerShell automation | Microsoft recommends CIM cmdlets. Get-CimInstance uses WS-Man by default for remote connections; DCOM is also an option, with setup dependent on the environment. |
| PowerShell WMI cmdlets | Understanding or maintaining older Windows PowerShell scripts | Get-WmiObject is a legacy cmdlet. Microsoft describes the older WMI cmdlets as deprecated and unavailable in PowerShell 6 and later. |
| WMI Scripting API | VBScript, Visual Basic, VBA, and other languages that support active scripting | This is an API for accessing WMI, not WMI itself. Its scripting objects generally are not marked safe for scripts embedded in Internet Explorer HTML pages. |
Microsoft’s PowerShell guidance on working with WMI explains the CIM and legacy cmdlet distinction. The WMI Scripting API reference lists supported scripting languages and the legacy Internet Explorer host caveat; that caveat is not a recommendation to deploy scripts in that host.
#1 Best Overall
Run a local PowerShell query
For a new PowerShell script, query a class with Get-CimInstance. This example requests operating-system instances in the commonly used rootcimv2 namespace and selects a few properties:
Get-CimInstance -Namespace 'rootcimv2' -ClassName Win32_OperatingSystem | Select-Object Caption, Version, BuildNumber
The returned properties depend on the class and provider. To inspect available properties on an instance, you can pipe the result to Get-Member. The cmdlet and class do not guarantee that every system exposes identical values.
Rank #2
Older scripts may instead contain Get-WmiObject. For example, the following is legacy syntax for Windows PowerShell 5.1, not PowerShell 6 or later:
Get-WmiObject -Namespace 'rootcimv2' -Class Win32_OperatingSystem
When updating such a script, check more than the cmdlet name: remote transport, output behavior, and any methods or provider-specific functionality the script relies on may matter.
Rank #3
Understand namespaces, classes, properties, methods, and events
- Namespace: A logical organization for WMI classes and providers.
rootcimv2is a commonly used namespace, but a class may be elsewhere. - Class: Describes a kind of managed object, such as an operating-system instance. A query names the class it wants to retrieve.
- Property: A value exposed on an instance, such as a version string. Provider support determines which values are available.
- Method: An operation a provider exposes for a class or instance. Availability and behavior are provider-specific; do not assume every class supports a method.
- Event: A notification a consumer can subscribe to when a provider supports the relevant event.
WMI consumers can query or enumerate data, invoke provider methods, and subscribe to events. These are distinct uses of the infrastructure: a successful read query does not establish that a method or event subscription is supported.
Query a remote computer
Remote WMI access is not simply a local query with a different computer name. The protocol, target configuration, credentials, namespace permissions, and network rules all affect whether a connection succeeds. Get-CimInstance uses WS-Man by default for remote connections according to Microsoft’s PowerShell material; CIM can also use DCOM. Classic WMI scripting clients use DCOM and need appropriate DCOM security configuration.
Rank #4
- Book - powershell for sysadmins: workflow automation made easy
- Language: english
- Binding: paperback
A basic CIM query can specify a remote computer and credentials:
$credential = Get-Credential
Get-CimInstance -ComputerName 'server01' -Credential $credential -Namespace 'rootcimv2' -ClassName Win32_OperatingSystem
This example uses the cmdlet’s default remote transport, WS-Man. It does not configure the target, open firewall access, grant namespace rights, or guarantee that the account is authorized. Follow the organization’s approved remote-management configuration, grant only the permissions required, and avoid broad firewall exposure. Microsoft’s guidance covers security for WMI scripting clients and emphasizes suitable security settings for local and remote namespace connections.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteBest Value
Troubleshoot failed queries
Diagnose the layer that failed before concluding that a class does not exist. A local success only confirms that the local query worked under its local security and provider conditions.
Quick Recap
- Access denied: Check which account the script is using, its rights on the target, and permissions on the requested namespace. For classic scripting clients, also verify the required DCOM security settings. Administrative rights can be relevant to remote connections, but use the least privilege that meets the requirement.
- Remote target unavailable or connection times out: Confirm the target name and reachability, then verify that the selected protocol—WS-Man by default for remote
Get-CimInstanceuse, or DCOM if explicitly used—is configured and permitted by the target and network. A transport or firewall problem is not evidence that a WMI class is missing. - Class not found or no expected data: Verify the namespace and class name, then check whether the target’s provider exposes that class and the requested properties. Provider availability and returned values can differ by managed object and system configuration.
- Legacy command fails in a newer PowerShell: Check the PowerShell edition/version.
Get-WmiObjectbelongs to legacy Windows PowerShell scripts and is not available in PowerShell 6 and later; use CIM cmdlets for new work or plan a compatibility-focused migration.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




