Search code examples
wmicpu

How can we get a CPU temperature through WMI?


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.


Solution

  • 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: