Tag Archives: MSAcpi_ThermalZoneTemperature

Monitoring Host System Temperature with Powershell.

FireI recently made some custom modifications to an old ESX virtual host to limit the noise produced by the CPU fans. After injecting resistors into the CPU fan circuits, I wanted to monitor the system temperature in case it ever exceeded the normal operating range. On my laptop, I prototyped a temperature monitoring script using WMI and PowerShell.

Everything was working beautiful until I tried scheduling the script on one of my VMs. The problem is, guest VMs know very little about the underlying host that they are running on. Since VMs can be migrated from host to host without interruption, it’s pointless for the OS to ask “What’s my temperature?” What I should have done, instead, is have the guest OS ask “EsxHost1, what is your temperature?” I admit, I had to laugh, when I realized the problem because I should have seen it coming. Back to the drawing board I went.

After my initial SNAFU, I abandoned WMI because it wasn’t going to work against ESX. Next, I decided to try VMware’s PowerCLI. Unfortunately, after a 200MB download and an hour of digging around, host temperature was nowhere to be found. Then I discovered VMware’s CIM interface. CIM is an open standard, similar to WMI, that allows you to control and manage hardware. PowerShell 3.0 has some new Cmdlets that improve the user experience of working with CIM. After a little Googling I found the class “CIM_NumericSensor” which contains, among other things, “Ambient Temp”.


Using the above script, I can remotely ask an ESX host for its system temperature; so far, everything has been “cool”. If you need to monitor your host from PowerShell 2.0, check out the cmdlet “New-WSManInstance”. Carter Shanklin wrote a post entitled “Monitoring ESX hardware with Powershell” on blogs.vmware.com. It should get you going in the right direction.