CIM_Thread

CIM Thread
root/cimv2abstractkey : Handlekey : ProcessHandle

The CIM_Thread class represents the ability to execute units of a process or task, in parallel. A process can have many threads, each of which is weak to the process.

On this page

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, InstallDate

Abstract 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, Flags

Properties

17 of 17 properties
NameTypeAccessDescription
Captionstringread

Short textual description of the object.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Caption for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, Caption |
    Select-Object -Property CSName, Handle, Caption
CreationClassName keystringread

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
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CreationClassName for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, CreationClassName |
    Select-Object -Property CSName, Handle, CreationClassName
CSCreationClassName keystringread

Scoping computer system's creation class name.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CSCreationClassName for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, CSCreationClassName |
    Select-Object -Property CSName, Handle, CSCreationClassName
CSName keystringread

Scoping computer system's name.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of CSName for each instance
Get-CimInstance -ClassName CIM_Thread -Property Handle, CSName |
    Select-Object -Property Handle, CSName
Descriptionstringread

Textual description of the object.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Description for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, Description |
    Select-Object -Property CSName, Handle, Description
ExecutionStateuint16read

Indicates the current operating condition of the thread.

Values (7)
ValueLabelDescription
0Unknown
1Other
2Ready
3Running
4Blocked
5Suspended Blocked
6Suspended Ready
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of ExecutionState for each instance
# 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 -Property CSName, Handle, ExecutionState |
    Select-Object -Property @(
        'CSName'
        'Handle'
        @{ Name = 'ExecutionState'; Expression = { $executionStateName[[int]$_.ExecutionState] } }
    )
Handle keystringread

Identifier for the thread.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Handle for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle |
    Select-Object -Property CSName, Handle
InstallDatedatetimeread

Date and time the object was installed. This property does not need a value to indicate that the object is installed.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of InstallDate for each instance
# CIM cmdlets already return a DateTime object: no conversion is needed
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, InstallDate |
    Select-Object -Property CSName, Handle, InstallDate
KernelModeTimeuint64read

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
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of KernelModeTime for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, KernelModeTime |
    Select-Object -Property CSName, Handle, KernelModeTime
Namestringread

Label by which the object is known. When subclassed, this property can be overridden to be a key property.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Name for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, Name |
    Select-Object -Property CSName, Handle, Name
OSCreationClassName keystringread

Scoping operating system's creation class name.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of OSCreationClassName for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, OSCreationClassName |
    Select-Object -Property CSName, Handle, OSCreationClassName
OSName keystringread

Scoping operating system's name.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of OSName for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, OSName |
    Select-Object -Property CSName, Handle, OSName
Priorityuint32read

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
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Priority for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, Priority |
    Select-Object -Property CSName, Handle, Priority
ProcessCreationClassName keystringread

Scoping process's creation class name.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of ProcessCreationClassName for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, ProcessCreationClassName |
    Select-Object -Property CSName, Handle, ProcessCreationClassName
ProcessHandle keystringread

Scoping process's handle.

Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of ProcessHandle for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, ProcessHandle |
    Select-Object -Property CSName, Handle, ProcessHandle
Statusstringread

Current status of the object. This property is inherited from CIM_ManagedSystemElement.

Values include the following:

Values (12)
ValueLabelDescription
OKOK
ErrorError
DegradedDegraded
UnknownUnknown
Pred FailPred Fail
StartingStarting
StoppingStopping
ServiceService
StressedStressed
NonRecoverNonRecover
No ContactNo Contact
Lost CommLost Comm
Code
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of Status for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, Status |
    Select-Object -Property CSName, Handle, Status
UserModeTimeuint64read

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
# Abstract class: Get-CimInstance returns the instances of its subclasses
# Value of UserModeTime for each instance
Get-CimInstance -ClassName CIM_Thread -Property CSName, Handle, UserModeTime |
    Select-Object -Property CSName, Handle, UserModeTime

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

  1. CIM_ManagedSystemElement
  2. CIM_LogicalElement
  3. CIM_Thread

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

Source: Microsoft Learn

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.