Home

GetCimInstance

Get-CimInstance is a PowerShell cmdlet that retrieves instances of CIM classes or specific properties from CIM providers on a local or remote computer. It communicates using the WS-Management protocol and is part of the CIM cmdlets introduced in Windows PowerShell 3.0 to replace the older WMI-oriented Get-WmiObject. The cmdlet returns objects that implement the CIM schema and are typically used for inventory, monitoring, and configuration tasks.

Common usage patterns include retrieving all instances of a class, filtering results, or querying a namespace.

Examples: Get-CimInstance -ClassName Win32_Process; Get-CimInstance -ClassName Win32_OperatingSystem -CimSession $sess; Get-CimInstance -Query "Select * From Win32_Process" -Namespace "root\cimv2";

By
default
it
queries
the
root\cimv2
namespace
but
you
can
specify
-Namespace,
-Query,
or
-Filter
to
narrow
results.
Remote
access
is
supported
via
-ComputerName
and
-Credential
or
by
creating
a
persistent
CIM
session
with
New-CimSession
and
passing
-CimSession.
The
-Property
parameter
can
limit
the
properties
returned
to
improve
performance.
Get-CimInstance
-ClassName
Win32_Service
-Filter
"State='Running'".