How to get CPU temperature on Windows system using both Snmp and cmd

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 
5

You can use Open Hardware Monitor it's an open source software (MPL v2). You can access the command line version here:

OpenHardwareMonitorReport.zip

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) 
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like