Search this site


Metadata

Articles

Projects

Presentations

Querying temperature in Windows

It occured to me tonight that I didn't have a good way to query temperatures from a Windows box. I'd used GUI tools to do it before, but that doesn't really lend itself to automation and monitoring.

The default SNMP configuration in XP doesn't export temperature (at least nothing I saw). I knew SMART had temperature information, but that wasn't CPU temperature or anything else outside the harddrive.

SMART data is accessible through a number of tools. I've used smartmontools before, but didn't know they had a build available for Windows until just now. Same tools as the Linux/FreeBSD/whatever versions. The device naming is the same as on the non-windows versions, and the smartctl manpage details the syntax. I wanted temperature information, and powershell helps make this pretty easy:

PS > .\smartctl.exe -a /dev/hda `
     | where {$_ -match "Temperature"} `
     | foreach { $_.split()[-1] }
46

After a bit of randomly permuting search queries, I found that some temperature information is available through WMI. The temperature values are in tenths of kelvin. We can query this from powershell:

PS > get-wmiobject MSAcpi_ThermalZoneTemperature -namespace "root/wmi" `
     | select CurrentTemperature,InstanceName

CurrentTemperature InstanceName
------------------ ------------
              3102 ACPI\ThermalZone\THRM_0
I found this particular WMI class by doing the following after getting some hints from search results:
PS > get-wmiobject -namespace "root/wmi" -list | findstr Temp
MSAcpi                                    MSAcpi_ThermalZoneTemperature

1 responses to 'Querying temperature in Windows'

Showing last 1 comments... (Click here to view all comments)

Drew Stephens wrote at Mon Dec 1 08:58:18 2008...
I'm impressed that WMI uses the Kelvin scale for temperatures; it is always good to see further use of my favorite incremental unit.


Leave a reply

You need javascript enabled to use this form. Anti-spam efforts ongoing. Also, if the comment doesn't show up, it's because the form expired. Go back and copy your comment, reload the form, and resubmit. Apologies if this is a hassle, I'm just playing with antispam methods right now. If this insists on not working, please email me about it.

Name (required)
E-mail (optional, if you want me to be able to email you back)
URL (also optional)
Comment: