Main example
List instances
# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName CIM_CurrentSensor |
Select-Object -Property DeviceID, Description, Status, InstallDateAbstract class: it has no instances of its own. Get-CimInstance returns the instances of its subclasses (Win32_CurrentProbe).
Examples
Decode numeric values
# Lookup table for Availability (values documented by Microsoft)
$availabilityName = @{
1 = 'Other'
2 = 'Unknown'
3 = 'Running/Full Power'
4 = 'Warning'
5 = 'In Test'
6 = 'Not Applicable'
7 = 'Power Off'
8 = 'Off Line'
9 = 'Off Duty'
10 = 'Degraded'
11 = 'Not Installed'
12 = 'Install Error'
13 = 'Power Save - Unknown'
14 = 'Power Save - Low Power Mode'
15 = 'Power Save - Standby'
16 = 'Power Cycle'
17 = 'Power Save - Warning'
18 = 'Paused'
19 = 'Not Ready'
20 = 'Not Configured'
21 = 'Quiesced'
}
# Lookup table for ConfigManagerErrorCode (values documented by Microsoft)
$configManagerErrorCodeName = @{
0 = 'This device is working properly'
1 = 'This device is not configured correctly'
2 = 'Windows cannot load the driver for this device'
3 = 'The driver for this device might be corrupted, or your…'
4 = 'This device is not working properly'
5 = 'The driver for this device needs a resource that Windows…'
6 = 'The boot configuration for this device conflicts with other…'
7 = 'Cannot filter'
8 = 'The driver loader for the device is missing'
9 = 'This device is not working properly because the controlling…'
10 = 'This device cannot start'
11 = 'This device failed'
12 = 'This device cannot find enough free resources that it can use'
13 = 'Windows cannot verify this device''s resources'
14 = 'This device cannot work properly until you restart your…'
15 = 'This device is not working properly because there is…'
16 = 'Windows cannot identify all the resources this device uses'
17 = 'This device is asking for an unknown resource type'
18 = 'Reinstall the drivers for this device'
19 = 'Failure using the VxD loader'
20 = 'Your registry might be corrupted'
21 = 'System failure: Try changing the driver for this device'
22 = 'This device is disabled'
23 = 'System failure: Try changing the driver for this device'
24 = 'This device is not present, is not working properly, or does…'
25 = 'Windows is still setting up this device'
26 = 'Windows is still setting up this device'
27 = 'This device does not have valid log configuration'
28 = 'The drivers for this device are not installed'
29 = 'This device is disabled because the firmware of the device…'
30 = 'This device is using an Interrupt Request (IRQ) resource…'
31 = 'This device is not working properly because Windows cannot…'
}
Get-CimInstance -ClassName CIM_CurrentSensor |
Select-Object -Property @(
'DeviceID'
'Description'
'Status'
'InstallDate'
@{ Name = 'Availability'; Expression = { $availabilityName[[int]$_.Availability] } }
@{ Name = 'ConfigManagerErrorCode'; Expression = { $configManagerErrorCodeName[[int]$_.ConfigManagerErrorCode] } }
)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_CurrentSensor |
Select-Object -Property DeviceID, 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_CurrentSensor
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Accuracy# | sint32 | read | Accuracy of the sensor for the measured property. Its value is recorded as plus or minus hundredths of a percent. This property, and the Resolution and Tolerance properties, are used to calculate the actual value of the measured physical property. Accuracy can vary depending on whether the device is linear over its dynamic range. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Availability# | uint16 | read | Availability and status of the device. Values (21)
Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Caption# | string | read | Short textual description of the object. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ConfigManagerErrorCode# | uint32 | read | Win32 Configuration Manager error code. Values (32)
Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ConfigManagerUserConfig# | boolean | read | Indicates whether the device is using a user-defined configuration. 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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CurrentReading# | sint32 | read | Current value indicated by the sensor. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description# | string | read | Textual description of the object. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DeviceID# key | string | read | Address or other identifying information to uniquely name the logical device. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ErrorCleared# | boolean | read | If TRUE, the error reported in the LastErrorCode property is now cleared. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ErrorDescription# | string | read | Free-form string that supplies information about the error recorded in the LastErrorCode property and corrective actions to perform. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| InstallDate# | datetime | read | Date and time when the object was installed. This property does not need a value to indicate that the object is installed. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| IsLinear# | boolean | read | If TRUE, the sensor is linear over its dynamic range. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LastErrorCode# | uint32 | read | Last error code reported by the logical device. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LowerThresholdCritical# | sint32 | read | Threshold value that specifies whether the sensor is operating under critical conditions. If the CurrentReading property is between LowerThresholdCritical and LowerThresholdFatal, then the current state is critical. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LowerThresholdFatal# | sint32 | read | Threshold value that specifies whether the sensor is operating under fatal conditions. If the CurrentReading property is below LowerThresholdFatal, then the current state is fatal. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LowerThresholdNonCritical# | sint32 | read | Threshold value that specifies whether the sensor is operating under normal or non-critical conditions. If the CurrentReading property is between LowerThresholdNonCritical and UpperThresholdNonCritical, then the sensor is reporting a normal value. If the CurrentReading property, however, is between LowerThresholdNonCritical and LowerThresholdCritical, then the current state is non-critical. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MaxReadable# | sint32 | read | Largest value of the measured property that can be read by the numeric sensor. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MinReadable# | sint32 | read | Smallest value of the measured property that can be read by the numeric sensor. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Name# | string | read | Label by which the object is known. When subclassed, this property can be overridden to be a key property. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NominalReading# | sint32 | read | Expected value for the numeric sensor. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NormalMax# | sint32 | read | Normal maximum range for the numeric sensor. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NormalMin# | sint32 | read | Normal minimum range for the numeric sensor. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PNPDeviceID# | string | read | Win32 Plug and Play device identifier of the logical device. Example: "*PNP030b" Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PowerManagementCapabilities# | uint16[] | read | Specific power-related capabilities of the logical device. Values (8)
Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PowerManagementSupported# | boolean | read | If TRUE, the device can be power managed, that is, put into a power-save state. This property does not indicate that power management features are currently enabled, or if enabled, which features are supported. For more information, see the PowerManagementCapabilities array. If FALSE, the integer value 1, for the string "Not Supported", should be the only entry in the PowerManagementCapabilities array. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Resolution# | uint32 | read | Ability of the sensor to resolve differences in the measured property. This property, and the Accuracy and Tolerance properties, are used to calculate the actual value of the measured physical property. This value can vary depending on whether the device is linear over its dynamic range. Unit: tenths of milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Status# | string | read | String that indicates the current status of the object. Operational and nonoperational status can be defined. Operational status can include "OK", "Degraded", and "Pred Fail". "Pred Fail" indicates that an element is functioning properly, but is predicting a failure (for example, a SMART-enabled hard disk drive). Nonoperational status can include "Error", "Starting", "Stopping", and "Service". "Service" can apply during disk mirror-resilvering, reloading a user permissions list, or other administrative work. Not all such work is online, but the managed element is neither "OK" nor in one of the other states. Values include the following: Values (12)
Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| StatusInfo# | uint16 | read | State of the logical device. If this property does not apply to the logical device, the value 5 (Not Applicable) should be used. Values (5)
Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SystemCreationClassName# key | string | read | Scoping system's CreationClassName property. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SystemName# key | string | read | Scoping system's Name property. Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Tolerance# | sint32 | read | Tolerance of the sensor for the measured property. This property, and the Resolution and Accuracy properties, are used to calculate the actual value of the measured physical property. Tolerance can vary depending on whether the device is linear over its dynamic range. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UpperThresholdCritical# | sint32 | read | Threshold value that specifies whether the sensor is operating under critical conditions. If the CurrentReading property is between UpperThresholdCritical and UpperThresholdFatal, then the current state is critical. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UpperThresholdFatal# | sint32 | read | Threshold value that specifies whether the sensor is operating under fatal conditions. If the CurrentReading property is above UpperThresholdFatal, then the current state is fatal. Unit: milliamps Code | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| UpperThresholdNonCritical# | sint32 | read | Threshold value that specifies whether the sensor is operating under normal or non-critical conditions. If the CurrentReading property is between LowerThresholdNonCritical and UpperThresholdNonCritical, then the sensor is reporting a normal value. If the CurrentReading property, however, is between UpperThresholdNonCritical and UpperThresholdCritical, then the current state is non-critical. Unit: milliamps Code |
Remarks
The CIM_CurrentSensor class is derived from CIM_NumericSensor.
WMI does not implement this class. For more information about WMI classes derived from CIM_CurrentSensor, 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_LogicalDevice
- CIM_Sensor
- CIM_NumericSensor
- CIM_CurrentSensor
Known subclasses
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- MOF file
- CIMWin32.mof
- DLL
- CIMWin32.dll
Class qualifiers
UUID("{DCA1D084-E3D3-11d2-8601-0000F8102E5F}") Abstract 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.