I am currently working on NMS Zabbix. After some R&D, I am able to get the CPU temperature info on Linux via snmp as well as terminal using LM-SENSORS. However, the same doesn't work for Windows; I see windows doesn't have LM-SENSORS, and maybe that's why LM-SENSOR-MIB is not giving any output for Windows. Can any one suggest which mibs can be used in Windows to get CPU temperature info, and also, how can I get same information in a cmd terminal?
2 Answers
How can I get the CPU temperature in a cmd shell?
Try the following.
Batch file (GetCpuTmp.cmd)
@echo off for /f "skip=1 tokens=2 delims==" %%A in ('wmic /namespace:\\root\wmi PATH MSAcpi_ThermalZoneTemperature get CurrentTemperature /value') do set /a "HunDegCel=(%%~A*10)-27315" echo %HunDegCel:~0,-2%.%HunDegCel:~-2% Degrees Celsius
Source Batch-file get CPU temperature in °C and set as variable, answer by David Ruhmann
Example output:
> GetCpuTemp.cmd
73.05 Degrees Celsius
PowerShell function (get-temperature.psm1)
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.
Source Get CPU Temperature With PowerShell
Example output:
> get-temperature
73.05 C : 163.49 F : 346.2K
-
thankyou I tried but it didn't work, I tried searching for some 3rd party application which can give me cmd output but I couldn't find any, do you have any idea about any app that can give temperature output in txt file or command prompt. I tried installing coretemp, realtemp, HWMonitor but all of them are GUI based and don't give output at terminal level or in txt file.– gadhviSep 5, 2017 at 14:10
-
-
>Yes , here is my cmd output >C:\paras> GetCpuTmp.cmd >Node - PUNSHI-WINDOWS >ERROR: >Description = Not supported >~0,-2HunDegCel:~-2 Degrees Celsius– gadhviSep 6, 2017 at 11:32
-
3This is not CPU temp, but rather mb temp stackoverflow.com/questions/9101295/…– fab2sDec 20, 2019 at 9:34
-
To run this you need to run the command here: stackoverflow.com/a/4038991 However, as stated in the comment above, it does not give you the CPU temperature.– alfreemaMay 6, 2021 at 15:33
You can use Open Hardware Monitor it's an open source software (MPL v2). You can access the command line version here:
Example part of the output:
PS C:\Users\myuser\OpenHardwareMonitorReport> .\OpenHardwareMonitorReport.exe
Open Hardware Monitor Report
--------------------------------------------------------------------------------
Version: 0.8.0.2
--------------------------------------------------------------------------------
Common Language Runtime: 4.0.30319.42000
Operating System: Microsoft Windows NT 6.2.9200.0
Process Type: 32-Bit
--------------------------------------------------------------------------------
Sensors
|
+- HP 00F52W (/mainboard)
|
+- Intel Core i7-3770 (/intelcpu/0)
| +- Bus Speed : 99.7734 99.7734 99.7784 (/intelcpu/0/clock/0)
| +- CPU Core #1 : 3691.62 3691.62 3791.58 (/intelcpu/0/clock/1)
| +- CPU Core #2 : 3691.62 3691.62 3791.58 (/intelcpu/0/clock/2)
| +- CPU Core #3 : 3791.39 3791.39 3891.36 (/intelcpu/0/clock/3)
| +- CPU Core #4 : 3691.62 3691.62 3891.36 (/intelcpu/0/clock/4)
| +- CPU Core #1 : 42 42 43 (/intelcpu/0/temperature/0)
| +- CPU Core #2 : 43 37 43 (/intelcpu/0/temperature/1)
| +- CPU Core #3 : 42 35 42 (/intelcpu/0/temperature/2)
| +- CPU Core #4 : 45 41 45 (/intelcpu/0/temperature/3)
| +- CPU Package : 45 43 45 (/intelcpu/0/temperature/4)
- Open Hardware Monitor Official website
- link to issue where the command line version is linked: #776
- More recent version with pending pull request
-
OpenHardwareMonitor doesn't work properly on my PC. No temperatures are shown. The only other program I have found is HWiNFO64 Pro which isn't free. Is there really no other software?– AenfaAug 3, 2022 at 14:05
-
@Aenfa did you check the recent version github.com/openhardwaremonitor/openhardwaremonitor/pull/…– uakAug 4, 2022 at 3:52
-
-
@Aenfa found this fork of the application with more recent updates github.com/hexagon-oss/openhardwaremonitor– uakAug 6, 2022 at 3:45
-
Also found this @Aenfa github.com/LibreHardwareMonitor/LibreHardwareMonitor– uakAug 8, 2022 at 6:30