CIM cmdlets
As mentioned in the previous section, the Common Information Model (CIM) cmdlets were introduced with PowerShell 3 and are the only commands available to access WMI in PowerShell 6 and above.
The CIM commands are as follows:
Get-CimAssociatedInstance
Get-CimClass
Get-CimInstance
Get-CimSession
Invoke-CimMethod
New-CimInstance
New-CimSession
New-CimSessionOption
Register-CimIndicationEvent
Remove-CimInstance
Remove-CimSession
Set-CimInstance
Each of these CIM cmdlets uses either the ComputerName
or CimSession
parameter to target the operation at another computer.
Getting instances
You can use the Get-CimInstance
command to execute queries for instances of WMI objects, as the following code shows:
Get-CimInstance -ClassName Win32_OperatingSystem
Get-CimInstance -ClassName Win32_Service
Get-CimInstance -ClassName Win32_Share
Several different parameters are available...