10

I installed WMI code creator from here, and I'm wondering how we can use it to get the CPU temperature.

The application gives many options (as shown below), but I am not sure where I have to click to get the CPU temperature.

enter image description here

I went to the description of WMI code creator and saw the following:

The WMI Code Creator tool allows you to generate VBScript, C#, and VB .NET code that uses WMI to complete a management task such as querying for management data, executing a method from a WMI class, or receiving event notifications using WMI.

  • 1
    Possible duplicate of [How to get CPU temperature?](https://stackoverflow.com/questions/1195112/how-to-get-cpu-temperature) – Thomas Jager Aug 17 '17 at 13:20
  • @ThomasJager I am very much new to WMI so I am not sure how can we use it get the CPU temperature ? Sorry. I am a beginner in WMI. –  Aug 17 '17 at 13:25
  • @ThomasJager In that link, its not written exactly where I have to click exactly in WMI application to get the CPU temperature. –  Aug 17 '17 at 13:40
  • 1
    this is not direct CPU temp but somewhere on the MB: https://stackoverflow.com/a/17083409/1747983 – Tilo Oct 24 '18 at 20:00

4 Answers4

19

Namespace: root\wmi
Path: MSAcpi_ThermalZoneTemperature

To run this (using wmic) from the Windows command line (cmd.exe) the command would be:

wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CriticalTripPoint, CurrentTemperature

Attention: the results are in Kelvin * 10, so you need to divide the result by 10, and then subtract 273.15 to get °Celsius.


More information:

Sebastian Hildebrandt
  • 2,661
  • 1
  • 14
  • 20
  • 3
    Here what I am getting: `Node - ABC-PC ERROR: Description = Not supported` –  Aug 17 '17 at 13:37
  • May be my BIOS doesn't support it ? –  Aug 17 '17 at 13:44
  • 2
    @user5447339: you need to run this also with admin privileges – Sebastian Hildebrandt Aug 18 '17 at 14:05
  • 2
    Appears to be manufacturer-dependent. This returns the case temperature for a local machine. – AlbinoDrought Jul 07 '20 at 18:37
  • Default responses on many motherboards. Values returned are not live and never change even after reboot. Sensors are there, but MB manufacturers do not provide you access through their drivers. Packages such as speedfan have invested the time to find the interfaces without the benefit of a roadmap. The answer is great if your MB supports the API; otherwise it is a broken idiot light. – trindflo Aug 03 '23 at 23:15
3

For those looking for a PowerShell solution:

Get-CimInstance -Namespace root/wmi -ClassName MsAcpi_ThermalZoneTemperature -Filter "Active='True' and CurrentTemperature<>2732" -Property InstanceName, CurrentTemperature |
    Select-Object InstanceName, @{n='CurrentTemperatureC';e={'{0:n0} C' -f (($_.CurrentTemperature - 2732) / 10.0)}}

The WMI/CIM filter here is only looking for active sensors that aren't returning 0 C as the temperature. My system returns several sensors with that value and I assume they're just disabled or otherwise non-functional. The InstanceName property should give you an approximate idea where the sensor is located. In my systems, even though the property is supposed to be in tenths of degrees K, it's always reporting in whole degree values and it appears to round the -273.15 C absolute zero to -273.2. Other systems or sensors may vary.

Note that you must be an administrator to query the MsAcpi_ThermalZoneTemperature class.

Bacon Bits
  • 30,782
  • 5
  • 59
  • 66
3

On my Dell-Laptop I could get the CPU-Temperature in Celsius like this:

$data = Get-WMIObject -Query "SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation" -Namespace "root/CIMV2"
@($data)[0].HighPrecisionTemperature
Carsten
  • 1,612
  • 14
  • 21
2

My HP laptop has HP specific WMI objects that contains temperature in Celcius units and fan RPM speed objects. Running this WMIC command in administrator mode will retrieve them:

wmic /NAMESPACE:\\root\HP\InstrumentedBIOS path HPBIOS_BIOSNumericSensor get Name,CurrentReading

Adding for syntax for looping it every 5 seconds:

FOR /L %G IN (1,1,100) DO wmic /NAMESPACE:\\root\HP\InstrumentedBIOS path HPBIOS_BIOSNumericSensor get Name,CurrentReading && PING localhost -l 0 -n 5 >NUL