Main example
List instances
# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName CIM_Process |
Select-Object -Property CSName, Handle, Description, Status, InstallDateAbstract class: it has no instances of its own. Get-CimInstance returns the instances of its subclasses (Win32_Process).
Examples
Decode numeric values
# Lookup table for ExecutionState (values documented by Microsoft)
$executionStateName = @{
0 = 'Unknown'
1 = 'Other'
2 = 'Ready'
3 = 'Running'
4 = 'Blocked'
5 = 'Suspended Blocked'
6 = 'Suspended Ready'
7 = 'Terminated'
8 = 'Stopped'
9 = 'Growing'
}
Get-CimInstance -ClassName CIM_Process |
Select-Object -Property @(
'CSName'
'Handle'
'Description'
'Status'
'InstallDate'
@{ Name = 'ExecutionState'; Expression = { $executionStateName[[int]$_.ExecutionState] } }
)Query a remote computer (CIM session)
review before running# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
Get-CimInstance -CimSession $cimSession -ClassName CIM_Process |
Select-Object -Property CSName, Handle, Description, Status, InstallDate
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName CIM_Process
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Caption# | string | read | Short textual description of the object. Code | |||||||||||||||||||||||||||||||||||||||
| CreationClassName# key | string | read | Name of the class or subclass used in the creation of an instance. When used with other key properties of the class, this property allows all instances of the class and its subclasses to be uniquely identified. Code | |||||||||||||||||||||||||||||||||||||||
| CreationDate# | datetime | read | Time that the process began executing. Code | |||||||||||||||||||||||||||||||||||||||
| CSCreationClassName# key | string | read | Scoping computer system's creation class name. Code | |||||||||||||||||||||||||||||||||||||||
| CSName# key | string | read | Scoping computer system's name. Code | |||||||||||||||||||||||||||||||||||||||
| Description# | string | read | Textual description of the object. Code | |||||||||||||||||||||||||||||||||||||||
| ExecutionState# | uint16 | read | Current operating condition of the process. Values (10)
Code | |||||||||||||||||||||||||||||||||||||||
| Handle# key | string | read | Identifies the process. A process identifier is a kind of process handle. Code | |||||||||||||||||||||||||||||||||||||||
| InstallDate# | datetime | read | Date and time the object was installed. This property does not need a value to indicate that the object is installed. Code | |||||||||||||||||||||||||||||||||||||||
| KernelModeTime# | uint64 | read | Time in kernel mode, in 100 nanosecond units. If this information is not available, a value of 0 (zero) should be used. For more information about using uint64 values in scripts, see Scripting in WMI. Unit: milliseconds Code | |||||||||||||||||||||||||||||||||||||||
| Name# | string | read | Label by which the object is known. When subclassed, this property can be overridden to be a key property. Code | |||||||||||||||||||||||||||||||||||||||
| OSCreationClassName# key | string | read | Scoping operating system's creation class name. Code | |||||||||||||||||||||||||||||||||||||||
| OSName# key | string | read | Scoping operating system's name. Code | |||||||||||||||||||||||||||||||||||||||
| Priority# | uint32 | read | Urgency or importance for process execution. If a priority is not defined for a process, a value of 0 (zero) should be used. Code | |||||||||||||||||||||||||||||||||||||||
| Status# | string | read | Current status of the object. Values include the following: Values (12)
Code | |||||||||||||||||||||||||||||||||||||||
| TerminationDate# | datetime | read | Time that the process was stopped or terminated. Code | |||||||||||||||||||||||||||||||||||||||
| UserModeTime# | uint64 | read | Time in user mode, in 100 nanosecond units. If this information is not available, a value of 0 (zero) should be used. For more information about using uint64 values in scripts, see Scripting in WMI. Unit: milliseconds Code | |||||||||||||||||||||||||||||||||||||||
| WorkingSetSize# | uint64 | read | Amount of memory, in bytes, that a process needs to execute efficiently for an operating system that uses page-based memory management. If the system does not have enough memory (less than the working set size), thrashing occurs. If the size of the working set is not known, use NULL or 0 (zero). If working set data is provided, you can monitor the information to understand the changing memory requirements of a process. For more information about using uint64 values in scripts, see Scripting in WMI. Unit: bytes Code |
Remarks
The CIM_Process class is derived from CIM_LogicalElement.
WMI does not implement this class. For WMI classes derived from CIM_Process, see Win32 Classes.
This documentation is derived from the CIM class descriptions published by the DMTF. Microsoft may have made changes to correct minor errors, conform to Microsoft SDK documentation standards, or provide more information.
Inheritance
Superclass chain
- CIM_ManagedSystemElement
- CIM_LogicalElement
- CIM_Process
Known subclasses
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- MOF file
- CIMWin32.mof
- DLL
- CIMWin32.dll
Class qualifiers
Abstract UUID("{8502C566-5FBB-11D2-AAC1-006008C78BC7}") DisplayName("Processes (CIM)") AMENDMENT
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.