1

I'm trying to access my CPU temperature using a WMI query because people said you can do it. I'm using a script I got online, and when I try to output the queried data it just gives me not supported thread. Here is the error output:

System.Management.ManagementObjectCollectionA first chance exception of type 'System.Management.ManagementException' occurred in System.Management.dll
The thread 0xc8ac has exited with code 259 (0x103).
A first chance exception of type 'System.Management.ManagementException' occurred in System.Management.dll
An error occurred while querying for WMI data: Not supported System.Management.ManagementObjectCollectionAn error occurred while querying for WMI data: Not supported The thread 0x9928 has exited with code 259 (0x103).
A first chance exception of type 'System.Management.ManagementException' occurred in System.Management.dll
System.Management.ManagementObjectCollectionAn error occurred while querying for WMI data: Not supported The program '[49728] GetHardwareInfo.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[49728] GetHardwareInfo.vshost.exe' has exited with code 0 (0x0).

I'm going to assume it's because there is no data, but I'm not sure.

private void get_cpu_temp()
{
    try
    {
        ManagementObjectSearcher searcher = new ManagementObjectSearcher(@"root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature");
        Console.Write(searcher.Get());
        foreach (ManagementObject queryObj in searcher.Get())
        {
            double temp = double.Parse(queryObj["CurrentTemperature"].ToString());
            temp = (temp - 2732) / 10d;
            Console.Write(temp.ToString());
        }
    }
    catch (ManagementException err)
    {
        Console.Write("An error occurred while querying for WMI data: " + err.Message);
    }
}
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Grant Zukel
  • 103
  • 2
  • 9

2 Answers2

1

As I mentioned in CPU temperature monitoring, your motherboard must support querying for CPU temperature via WMI.

In this case, it looks like your motherboard doesn't support querying via WMI so it's simply not going to be an option for you.

Community
  • 1
  • 1
Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
1

Not all machines support reading of the CPU temperature. It's a function of your BIOS software. Sometimes the BIOS manufacturer will supply DLL files that you can reference to call the required function and return the details. When you reboot your computer get the BIOS manufacturer and model number and check and see if they support it.

From MSAcpi_ThermalZoneTemperature not supported..

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
John
  • 3,627
  • 1
  • 12
  • 13