Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

CIM · PowerShell Automation

Direct answer

CIM cmdlets (Get-CimInstance, Invoke-CimMethod, New-CimSession) query Windows management data over WS-Man, replacing the older WMI cmdlets and working well remotely.

When to use this

Use this when querying Windows management data with CIM cmdlets.

First 30 seconds

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.

Operational verification

CIM cmdlet → WS-Man → WMI provider → objects

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Windows / PowerShell 7.5
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformWindows / PowerShell 7.5 · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when querying Windows management data with CIM cmdlets.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

3 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points
  • Get-CimInstance replaces Get-WmiObject.
  • Uses WS-Man remotely.
  • CimSessions reuse connections.
Key checks
  • Get-CimInstance Win32_OperatingSystem — local CIM query
  • Get-CimInstance -ComputerName <host> Win32_Service — remote over WinRM
  • New-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.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
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
Technical examples

Configuration & expected output

Concrete examples are shown only when the stored reference contains an actual configuration or output shape for this Topic.

Configuration example

Windows / PowerShell 7.5 7.5/currentMinimal authored PowerShell pattern for CIM

Assumptions: Review target identity, permissions and environment before mutation.

$session = New-CimSession -ComputerName server01
Get-CimInstance -CimSession $session -ClassName Win32_OperatingSystem
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docWindows / PowerShell 7.5 7.5/current

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%
Embedded reference data

Quick lookup tables

CIM · PowerShell operational reference

Topic-specific PowerShell runtime identity, persistence, verification, output and failure-boundary lookup.

BoundaryCIM reference
Runtime identityPowerShell edition/version + command/module source
Persistent intentScript/module/config prerequisites under source control
VerificationRead-only discovery → execution evidence → independent target read-back
Output contractStructured objects/streams before formatting
Failure boundarySeparate engine/binding from transport/API/native and target-state failures
Depth when you need it

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.

Confirmation

Confirm action

Continue?