3

How can I get the cpu temperature using c/c++/vb.net/c# ? I already found this link Get CPU Temperature in .Net, but I'm not sure if it really works.

Also I would like to know if there is a way other than using wmi queries.

Jack B Nimble
  • 5,039
  • 4
  • 40
  • 62
Ali Tarhini
  • 5,278
  • 6
  • 41
  • 66
  • Did you try the code at the link you provided? Looks like the approach I would take. WMI is designed specifically for this sort of thing...Is there a reason you want to do it differently? – Robert Harvey Jan 26 '10 at 00:24
  • dup: http://stackoverflow.com/questions/1195112/how-to-get-cpu-temperature – Gordon Gustafson Jan 26 '10 at 00:25
  • Well, the duplicate question appears to have the incorrect answer marked as correct. The second answer has a veiled reference to a WMI utility. All in all pretty unhelpful, I'd say. – Robert Harvey Jan 26 '10 at 00:27

2 Answers2

1

It can be done in your code via WMI. I've found a tool from Microsoft that creates code for it.

The WMI Code Creator tool allows you to generate VBScript, C#, and VB .NET code that uses WMI to complete a management task such as querying for management data, executing a method from a WMI class, or receiving event notifications using WMI.

You can download it here.

Jet
  • 528
  • 6
  • 17
  • @Searush I did install WMI code creator, just wondering how can we use it to get the CPU temperature ? –  Aug 17 '17 at 13:03
0

It does not appear possible to use the Win32_TemperatureProbe wmi class, at least when I query it I get nothing back, and this appears to be common.

I found this custom c# driver someone wrote for retrieving the information:

http://temperature.myweb.hinet.net/index_en.htm

It includes the source code.

Jack B Nimble
  • 5,039
  • 4
  • 40
  • 62