3

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 Answers1

2

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.

Helen
  • 87,344
  • 17
  • 243
  • 314
ravikanth
  • 24,922
  • 4
  • 60
  • 60
  • Why Win32_Fan return null value ? – Pourdad.Daneshmand Jun 03 '13 at 21:19
  • You should check your WMI repository and see if it is corrupt. I can see the output when I create an instance of Win32_Fan. In any case, Win32_Fan is not related to your original question. Please mark if I have answered your initial question. – ravikanth Jun 04 '13 at 08:19