Get CPU temperature using Powershell

Getting CPU temperature using Powershell is a straightforward process. It is safer than using third-party apps for CPU temperature monitoring.

You would have noticed that most recommendations for CPU temperature monitoring on Windows 11 systems ask you to install third-party apps or applications on the computer to monitor CPU temperatures. Installing third-party apps is fraught with unintended consequences. Plus, in most corporate networks, you may have a hard time in getting these apps installed on Windows 11 systems.

So, we look at alternatives that can check CPU temperature on a Windows 11 computer through Powershell. With a single command line directive, we can get the temperature value of the CPU on the Powershell command prompt.

However, there are a few caveats that need to be aware of:

  • This Powershell command directive’s output generates a CPU temperature value in Kelvin.
  • Once you know the Kelvin temperature, you can convert it to Celsius by subtracting 273 from the Kelvin temperature
  • An alternative is to use the Powershell script shared below.

Before starting the process of finding the CPU temperature on a Windows 11 computer, we need to start Powershell with administrative privileges on the computer.

To do so, you can type ‘pwsh’ in the search box of Windows 11 computer and then choose to ‘Run it as administrator’. The screenshot displays the exact command and the administrative option to check.

Run Powershell with administrative privileges

Get CPU temperature using WMI Object

We will make use of the WMI Object method to find the three values of temperature of the CPU on a Windows 11 computer.

For this exercise, we will use the in-build class of Win32_PerfFormattedData_Counters_ThermalZoneInformation.

The command directive below needs to be used to get the CPU temperature values on a Windows 11 computer:

Get-WMIObject -Query “SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation” -Namespace “root/CIMV2” | Select-object Temperature

The WMI-object command output is piped to the Select-object qualifier to get the temperature values in Kelvin.

The command and the output we get can be seen in the screenshot shared below:

CPU temperature using Powershell
You can see that I got 3 temperature values:
  • 283 Kelvin is equivalent to 10 degree Celsius
  • 303 Kelvin is equivalent to 30 degree Celsius
  • 301 Kelvin is equivalent to 28 degree Celsius

This is a quick and easy way to get an idea about the CPU temperature on a Windows 11 computer in Kelvin.

Similar to the WMI Object method, you can use the CIM Instance command below to find the temperature values in Kelvin. The command output is identical to what we have seen above.

Get-CIMInstance -Query “SELECT * FROM Win32_PerfFormattedData_Counters_ThermalZoneInformation” -Namespace “root/CIMV2” | Select-object Temperature

Get CPU temperature in Celsius using the Powershell function

You can use a Powershell script or function to get the temperature values of the CPU in Celsius directly. The function below will bring out the three temperature values of CPU temperature in Celsius.

function Get-Temperature {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace “root/wmi”
$returntemp = @()

foreach ($temp in $t.CurrentTemperature) { $currentTempKelvin = $temp / 10 $currentTempCelsius = $currentTempKelvin – 273.15 $currentTempFahrenheit = (9/5) * $currentTempCelsius + 32 $returntemp += $currentTempCelsius.ToString() + ” C : ” + $currentTempFahrenheit.ToString() + ” F : ” + $currentTempKelvin + “K” } return $returntemp

}

Get-Temperature

You can use this function on the Powershell prompt. Or, you can save it as a PS file and execute it on the system.

I chose to put the function on the Powershell prompt directly and got the temperature values in Kelvin, Fahrenheit, and Celsius as displayed in the command output screenshot below.

CPU temperature in Celsius using Powershell

Summary

Both these methods shared above will help you fetch the CPU temperature of a local or remote computer using Powershell. You can use these cmdlets on Windows 11, Windows 10, and Windows servers as well.

The good thing about getting temperature values through Powershell is that we do not need to install any third-party applications on your desktop or servers.

Rajesh Dhawan

Rajesh Dhawan is a technology professional who loves to write about Cyber-security events and stories, Cloud computing and Microsoft technologies. He loves to break complex problems into manageable chunks of meaningful information.