Jump to content

Anyone know of a way to dump CPU temps to a text file?


Recommended Posts

I help manage a little over 2,000 workstations. One of the things I'm not able to do, is monitor the workstation temperatures.

What I would love to find, is a program that runs for literally like a second, just enough to grab CPU temperatures, and log that into a text file. Then I can just pull the file off remotely. I would like to have all this happen completely silent, but if not, I can figure something out. From what I can tell, programs like Speedfan/CoreTEMP wont dump to a text file unless you physically open them up first.

Anyone know of any programs that may help me with this? Or any other way?

Link to post
Share on other sites

I created and tested the following Windows Management Instrumention function in KiXtart.


Dim $objWMIServ, $CPU_temp
$CPU_temp=0
$objWMIServ=GetObject("winmgmts://./root\WMI").ExecQuery("SELECT * FROM MSAcpi_ThermalZoneTemperature","WQL",48)

For Each $obj In $objWMIServ
$cpu=$obj.CurrentTemperature
Next
$cpu_temp = ($cpu/10)-273.15
$cpu_temp = "$cpu_temp C"
? $CPU_temp
sleep 5

However it reports the CPU temperature as "60 C" which is not correct. I tried researching this and found

winmgmts://./root/OpenHardwareMonitor using "SELECT * FROM Sensor"

Which should be something like...


$objWMIServ=GetObject("winmgmts://./root/OpenHardwareMonitor").ExecQuery("SELECT * FROM Sensor","WQL",48)

However, I am getting errors :( . Perhaps Ron (aka; AdvancedSetup) may have an implementation idea.

Once it works it is an easy matter to redirect the output to a TXT file and run periodically.

Link to post
Share on other sites

I am not a programmer, I am a scriptor.

In theory one can use Windows Management Instrumentation (WMI) to obtain the CPU temperature. My initial script was close. However it is not getting the right value. Conceivably there is a way to get the correct value. I just could not come up with it, and script it, in the 45 minutes I looked into this issue.

Research found the following URL...

http://social.msdn.m...5-8be3908a21b8/

At the bottom reply...

The Microsoft function for finding CPU temperature does not work. Don't use it. If you search the Microsoft forums, you will find the Microsoft people blaming the motherboard manufacturers for not implementing their standards.

Further research found this URL...

http://stackoverflow...-false-readings

Where the query indicates "My problem, is that the script displays 59.55 C" which is what I get.

The reply to that was using OpenHardwareMonitor which provides a WMI interface. I did not see that when I made my initial reply. So it is possible (in theory) to employ OpenHardwareMonitor and use WMI and get the correct CPU temperature.

Link to post
Share on other sites

Humm... Yeah, that would actually be an ideal way...

I just got RealTemp 3.70 to work, but it isn't going to work for me. I modified the INI file, so it launches minimized, and logs the temperatures, but you actually have to physically close the program for it to dump the results to the text file. If i try to taskkill it/PID Kill it, or use Close Application through Kaseya, it wont report, which is very odd... So I'm afraid I'm back to the drawing board :(

Link to post
Share on other sites

  • Root Admin

Don't have a lot of time to look at it right now but using VBScript this should work as a quick one assuming your motherboard is new enough and the OS supports the WMI call to it.

Save the file as CPUTEMP.VBS using Notepad. Then you can run it using CScript

C:\TEST\CSCRIPT CPUTEMP.VBS

strServer = "."
Set objWMI = GetObject("winmgmts://" & strServer & "/root\WMI")
Set objInstances = objWMI.InstancesOf("MSAcpi_ThermalZoneTemperature",48)

On Error Resume Next
For Each objInstance in objInstances
With objInstance
WScript.Echo "Current Temp: " & .CurrentTemperature / 10 - 273.15
End With
On Error Goto 0
Next

If I have time I'll look at a better solution later on.

Link to post
Share on other sites

  • Root Admin

As I said I'll have to look at it further when I have time, but that is not what it says on my system. It says it is 27.85c in zone 0 and 29.85 in zone 1

If it's saying 60c for you then it may be an issue on your system.

Assuming there is a valid WMI entry then one should be able to obtain the temp for each core but not sure that WMI will have it.

60 degrees Celsius = 140 degrees Fahrenheit

27 degrees Celsius = 80.6 degrees Fahrenheit

Link to post
Share on other sites

Apparently implementation by manufacturers has something to do with it returning bad data...

From Post #4

http://social.msdn.m...5-8be3908a21b8/

At the bottom reply...

The Microsoft function for finding CPU temperature does not work. Don't use it. If you search the Microsoft forums, you will find the Microsoft people blaming the motherboard manufacturers for not implementing their standards.

So it could be hit of miss based upon chip-sets.

I have tried using Open Hardware Monitor's COM Automation, which uses Aga Controls [Aga.Controls.dll] but I have problems coding it.

Link to post
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

Back to top
×
×
  • Create New...

Important Information

This site uses cookies - We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.