3
votes

I'm using wmi objecrs in c# language.How can I get CPU Temp ? My Code :

My Select query return null value and foreach is not working because my searcher object is null.

try { ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\CIMV2", "SELECT * FROM Win32_TemperatureProbe");

        foreach (ManagementObject queryObj in searcher.Get())
        {
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("Win32_TemperatureProbe instance");
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("CurrentReading: {0}", queryObj["CurrentReading"]);
        }
    }
    catch (ManagementException)
    {

    }

Please give me clarification code. I'm search in google,bing but I can't find any good code. I use MSAcpi_ThermalZoneTemperature but I got error.

Best Regards

1

1 Answers

2
votes

CurrentReading is not implemented in the current release.

From the documentation:

Most of the information that the Win32_TemperatureProbe WMI class provides comes from SMBIOS. Real-time readings for the CurrentReading property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate the CurrentReading property. The CurrentReading property's presence is reserved for future use.