Skip to content

Instantly share code, notes, and snippets.

@bennylangston
Forked from jeffa00/Get-Temperature
Created March 6, 2019 05:22
Show Gist options
  • Save bennylangston/50cea87e6cd364e0095ebc605797fc94 to your computer and use it in GitHub Desktop.
Save bennylangston/50cea87e6cd364e0095ebc605797fc94 to your computer and use it in GitHub Desktop.
Get CPU Temperature With PowerShell
function Get-Temperature {
$t = Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace "root/wmi"
$currentTempKelvin = $t.CurrentTemperature / 10
$currentTempCelsius = $currentTempKelvin - 273.15
$currentTempFahrenheit = (9/5) * $currentTempCelsius + 32
return $currentTempCelsius.ToString() + " C : " + $currentTempFahrenheit.ToString() + " F : " + $currentTempKelvin + "K"
}
# Save in your c:\users\yourName\Documents\WindowsPowerShell\modules\ directory
# in sub directory get-temperature as get-temperature.psm1
# You **must** run as Administrator.
# It will only work if your system & BIOS support it. If it doesn't work, I can't help you.
# Just type get-temperature in PowerShell and it will spit back the temp in Celsius, Farenheit and Kelvin.
# More info on my blog: http://ammonsonline.com/is-it-hot-in-here-or-is-it-just-my-cpu/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment