Use this when querying Windows management data with CIM cmdlets.
CIM · PowerShell Automation
CIM cmdlets (Get-CimInstance, Invoke-CimMethod, New-CimSession) query Windows management data over WS-Man, replacing the older WMI cmdlets and working well remotely.
1. CIM cmdlets query WMI classes over WinRM (WS-Man) or DCOM.
2. Replace legacy Get-WmiObject.
3. Reuse CimSessions for many queries.
4. Filter on the server (-Filter).
5. Works in PowerShell 7.
CIM cmdlet → WS-Man → WMI provider → objects
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
Use Get-CimClass to show class/namespace availability and Get-CimInstance for read-only instance retrieval before invoking methods. Inspect CimSession computer/protocol context and query the same property after a mutation. For remote failures, separate WSMan/DCOM transport, authentication, namespace authorization, provider availability and method result.
Step 2 Common mistakes Narrow the fault
- Using WMI cmdlets instead of CIM.
Step 3 Where it fails Narrow the fault
A successful CIM session does not show a specific class/provider exists, and retrieving an instance does not show a subsequent method is authorized or supported. Windows-only module availability is a platform boundary for PowerShell 7. Keep transport/session, CIM namespace/class/provider and target resource state distinct.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Get-CimInstance replaces Get-WmiObject.
- Uses WS-Man remotely.
- CimSessions reuse connections.
Get-CimInstance Win32_OperatingSystem— local CIM queryGet-CimInstance -ComputerName <host> Win32_Service— remote over WinRMNew-CimSession -ComputerName <host>— reuse session
ReferenceWhy it matters1 section · depth on demand
In depth
CIM cmdlets query and manage Windows management data — hardware, OS, services, disks, network adapters — through WMI classes, using WS-Man (WinRM) by default. They replace the older WMI cmdlets and work with sessions for efficient remote queries.
$s = New-CimSession -ComputerName srv01, srv02
Get-CimInstance -CimSession $s -ClassName Win32_OperatingSystem |
Select-Object PSComputerName, Caption, Version, LastBootUpTime
Get-CimInstance -CimSession $s Win32_LogicalDisk -Filter "DriveType=3" |
Select-Object PSComputerName, DeviceID, @{n='FreeGB';e={[math]::Round($_.FreeSpace/1GB,1)}}
Invoke-CimMethod -CimSession $s -ClassName Win32_Process -MethodName Create -Arguments @{CommandLine='gpupdate /force'}
Remove-CimSession $s
Use -Filter (WQL, evaluated remotely) rather than Where-Object, and DCOM session options (New-CimSessionOption -Protocol Dcom) only for old systems without WinRM.
ReferenceImportant terms & boundaries1 section · depth on demand
PowerShell mechanics
The CimCmdlets module exposes Common Information Model instances, classes, associations and methods through CIM sessions. On current PowerShell the module is Windows-only; remote CIM commonly uses WSMan, and session options can select alternative behavior such as DCOM where supported. CIM instances are management representations, not arbitrary live .NET objects from the remote process.
ReferenceConfiguration & state1 section · depth on demand
Authoring and lifecycle
Create explicit CimSession objects when authentication, protocol or reuse matters, and keep namespace/class identity explicit. Prefer CIM cmdlets over legacy WMI cmdlets for new Windows management automation where supported. Treat class/method availability as OS/provider-specific and version the automation against the target management provider contract.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Configuration & expected output
Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.
Configuration example
Assumptions: Review target identity, permissions and environment before mutation.
$session = New-CimSession -ComputerName server01
Get-CimInstance -CimSession $session -ClassName Win32_OperatingSystemVerification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Microsoft Learn documentation reviewed for bounded PowerShell reference claims. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/powershell/module/cimcmdlets/?view=powershell-7.5 · confidence 94%Quick lookup tables
CIM · PowerShell operational reference
Topic-specific PowerShell runtime identity, persistence, verification, output and failure-boundary lookup.
| Boundary | CIM reference |
|---|---|
| Runtime identity | PowerShell edition/version + command/module source |
| Persistent intent | Script/module/config prerequisites under source control |
| Verification | Read-only discovery → execution evidence → independent target read-back |
| Output contract | Structured objects/streams before formatting |
| Failure boundary | Separate engine/binding from transport/API/native and target-state failures |
Deep reference
Healthy vs suspicious evidence
Output interpretation
CIM output is a representation of management-provider data and can include system properties that should not be mistaken for user configuration. Method invocation can return provider-specific return values even when transport succeeded. Formatting can hide key identifiers such as CimSystemProperties; inspect the actual instance properties needed for correlation.