PowerShell WMI and CIM

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

CIM vs WMI

As of PowerShell 3.0, there are two ways to work with management classes in PowerShell, WMI and CIM. PowerShell 1.0 and 2.0 only supported the WMI-module which is now superseeded by the new and improved CIM-module. In a later release of PowerShell, the WMI-cmdlets will be removed.

Comparison of CIM and WMI-modules:

CIM-cmdletWMI-cmdletWhat it does
Get-CimInstanceGet-WmiObjectGets CIM/WMI-objects for a class
Invoke-CimMethodInvoke-WmiMethodInvokes a CIM/WMI-class method
Register-CimIndicationEventRegister-WmiEventRegisters event for a CIM/WMI-class
Remove-CimInstanceRemove-WmiObjectRemove CIM/WMI-object
Set-CimInstanceSet-WmiInstanceUpdates/Saves CIM/WMI-object
Get-CimAssociatedInstanceN/AGet associated instances (linked object/classes)
Get-CimClassGet-WmiObject -ListList CIM/WMI-classes
New-CimInstanceN/ACreate new CIM-object
Get-CimSessionN/ALists CIM-sessions
New-CimSessionN/ACreate new CIM-session
New-CimSessionOptionN/ACreates object with session options; protocol, encoding, disable encryption etc. (for use with New-CimSession)
Remove-CimSessionN/ARemoves/Stops CIM-session

Additional resources

Should I use CIM or WMI with Windows PowerShell? @ Hey, Scripting Guy! Blog



Got any PowerShell Question?