Pcornel
Automation · PowerShell Automation

CIM

Cheat sheet · https://pcornel.dk/topic.php?topic=5243

Back to the Topic

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.

Remember

  • Get-CimInstance replaces Get-WmiObject.
  • Uses WS-Man remotely.
  • CimSessions reuse connections.

First checks

  • Get-CimInstance Win32_OperatingSystem — local CIM query
  • Get-CimInstance -ComputerName <host> Win32_Service — remote over WinRM
  • New-CimSession -ComputerName <host> — reuse session

Verify in this order

CIM cmdlet → WS-Man → WMI provider → objects

Where it usually breaks

Script/input → command/module binding → local/remoting session → request accepted → command result → target object read-back → effective runtime state → workload.

CIM · PowerShell operational reference

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

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5243

Confirmation

Confirm action

Continue?