Automation · PowerShell Automation
CIM
Cheat sheet · https://pcornel.dk/topic.php?topic=5243
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 queryGet-CimInstance -ComputerName <host> Win32_Service— remote over WinRMNew-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
| 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 |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5243