Main example
List instances
# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName CIM_Thread |
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_Thread).
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'
}
Get-CimInstance -ClassName CIM_Thread |
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_Thread |
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_Thread
$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 allow all instances of the class and its subclasses to be uniquely identified. 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 | Indicates the current operating condition of the thread. Values (7)
Code | |||||||||||||||||||||||||||||||||||||||
| Handle# key | string | read | Identifier for the thread. 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 for execution of a thread. A thread can have a different priority than its owning process. If this information is not available for a thread, a value of 0 (zero) should be used. Code | |||||||||||||||||||||||||||||||||||||||
| ProcessCreationClassName# key | string | read | Scoping process's creation class name. Code | |||||||||||||||||||||||||||||||||||||||
| ProcessHandle# key | string | read | Scoping process's handle. Code | |||||||||||||||||||||||||||||||||||||||
| Status# | string | read | Current status of the object. This property is inherited from CIM_ManagedSystemElement. Values include the following: Values (12)
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 |
Remarks
The CIM_Thread class is derived from CIM_LogicalElement.
WMI does not implement this class. For WMI classes derived from CIM_Thread, 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
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("{8502C571-5FBB-11D2-AAC1-006008C78BC7}") 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.