Get-CimInstance
Use Get-CimInstance to get instances of CIM classes from a CIM server. See CimCmdlets module requirements and examples.
Documentation: Microsoft Learn — Get-CimInstance
Syntax
See the command anatomy
Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.
Get-CimInstance [[-ClassName] <string>] [-ComputerName <String[]>] [-Filter <String>] [-Property <String[]>] [<CommonParameters>]- Stage 1Get-CimInstance
-ClassName -ComputerName -Filter -Property
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
List all with Get-CimInstance
Show reference output
Sample output · fictional data, shaped like the real thing
SystemDirectory : C:\Windows\system32 Organization : Contoso BuildNumber : 26100 Caption : Microsoft Windows 11 Pro Version : 10.0.26100 CSName : WS01 LastBootUpTime : 9/8/2026 6:15:04 AM
Get-CimInstance -Filter "DriveType=3"
Show reference output
Sample output · fictional data, shaped like the real thing
DeviceID DriveType ProviderName VolumeName Size FreeSpace -------- --------- ------------ ---------- ------------ ------------ C: 3 255456780288 188888121344 D: 3 999995228160 612345678901
Show disk sizes in GB
Show reference output
Sample output · fictional data, shaped like the real thing
DeviceID VolumeName SizeGB FreeGB -------- ---------- ------ ------ C: 237.91 175.92 D: 931.32 570.31
Parameters
Parameter definitions:
-ClassName-ComputerName-Filter-Property
Practical use and troubleshooting
Practical scenario: Use Get-CimInstance when you need to get instances of CIM classes from a CIM server. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Access denied or transport failure requires checking the target, credentials and protocol. Test a local query separately from the remote connection and do not assume ping proves CIM access. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
Version note: PowerShell 7 removed the -ComputerName parameter: use New-CimSession to query a remote host instead of copying a Windows PowerShell-only example.
See also: New-CimSession. Get-CimInstance queries instances; New-CimSession creates a reusable connection description for later CIM calls. A session object is not a hardware inventory result. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Get-CimInstance Use Get-CimInstance to get instances of CIM classes from a CIM server. See CimCmdlets module requirements and examples.
Next: Get-AzContext