Jump to content

Malwarebytes

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


11 replies to this topic

#1
7angofragger

    New Member

  • Members
  • Pip
  • 3 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?

#2
David H. Lipman

    Forum Deity

  • Experts
  • PipPipPipPipPipPip
  • 2,481 posts
  • Gender:Male
  • Location:Jersey Shore USA
  • Interests:Malware Research, dSLR Photography, Numismatics & Surf Fishing
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.
David H. Lipman
DLipman@Verizon.Net

#3
brohandy

    New Member

  • Members
  • Pip
  • 1 posts
Is it able to be used though? Like does it work successfully?
Does Malware make cups of herbal tea? If so, it would make the following brews: Organic Parsley Tea, Organic Patchouli Tea,
Organic Pau d’arco Tea and Organic Raspberry Tea. Organic herbal tea is outstanding for ones health.

#4
David H. Lipman

    Forum Deity

  • Experts
  • PipPipPipPipPipPip
  • 2,481 posts
  • Gender:Male
  • Location:Jersey Shore USA
  • Interests:Malware Research, dSLR Photography, Numismatics & Surf Fishing
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...

Quote

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.
David H. Lipman
DLipman@Verizon.Net

#5
7angofragger

    New Member

  • Members
  • Pip
  • 3 posts
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 :(

#6
AdvancedSetup

    Forum Deity

  • Administrators
  • PipPipPipPipPipPip
  • 26,899 posts
  • Gender:Male
  • Location:US
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.
Ron Lewis
Manager, Online Support

Posted Image

Follow us: Twitter, Become a fan: Facebook

#7
David H. Lipman

    Forum Deity

  • Experts
  • PipPipPipPipPipPip
  • 2,481 posts
  • Gender:Male
  • Location:Jersey Shore USA
  • Interests:Malware Research, dSLR Photography, Numismatics & Surf Fishing
Ron, that's a VBS version of the KiXtart script I provided which gives a temperature of 60 Deg C which is not correct.
David H. Lipman
DLipman@Verizon.Net

#8
AdvancedSetup

    Forum Deity

  • Administrators
  • PipPipPipPipPipPip
  • 26,899 posts
  • Gender:Male
  • Location:US
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


Ron Lewis
Manager, Online Support

Posted Image

Follow us: Twitter, Become a fan: Facebook

#9
David H. Lipman

    Forum Deity

  • Experts
  • PipPipPipPipPipPip
  • 2,481 posts
  • Gender:Male
  • Location:Jersey Shore USA
  • Interests:Malware Research, dSLR Photography, Numismatics & Surf Fishing
GUI based utilities deny the 60 Deg C result.

But, I don't need a utility. My desktop can display its parameters including the CPU and MB temperatures as seen below.

Attached Images

  • Attached Image: IMG_3707.JPG

David H. Lipman
DLipman@Verizon.Net

#10
AdvancedSetup

    Forum Deity

  • Administrators
  • PipPipPipPipPipPip
  • 26,899 posts
  • Gender:Male
  • Location:US
Not sure David - as I said my own computer here does not come back with 60
Have not looked into the code and have not run on other computers

Ron Lewis
Manager, Online Support

Posted Image

Follow us: Twitter, Become a fan: Facebook

#11
David H. Lipman

    Forum Deity

  • Experts
  • PipPipPipPipPipPip
  • 2,481 posts
  • Gender:Male
  • Location:Jersey Shore USA
  • Interests:Malware Research, dSLR Photography, Numismatics & Surf Fishing
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...

Quote

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.
David H. Lipman
DLipman@Verizon.Net

#12
TruthRealm

    New Member

  • Members
  • Pip
  • 29 posts
  • Gender:Male
  • Location:Virginia USA
what about CPUId's paid Pro version of their HWMonitor product? I believe it interfaces with WMI and know for a fact it has remote monitoring and logging support, whih I believe uses basic text files by default





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

Follow Us