Get CPU Fan Speed and CPU Temp

M

Mike C#

William DePalo said:
I wish Ferraris were cheap. :)

But then we wouldn't want them :)
Seriously, I've not had an on-the-job need to use WMI, but my experiments
with it have resulted in less than stellar results. I suggest that you try
on your systems some samples known to work elsewhere before you start
writing code.

Yes, this is my first foray into WMI as well. I've found that you do need
COM to access it in unmanaged code, and I've built a little sample that
allows me to use WQL (WMI Query Language) to retrieve some data. I created
a little C++ wrapper class that creates the COM object and initializes WMI
in its constructor, and gets rid of it in the destructor. Then I figure I
can expose some methods that return exactly what I want (fan speed, CPU
temp., etc.) I've tested it with a few WQL queries and can retrieve some
information like printers, logical disk drives, etc., etc.

So far so good.

The issue now is that, while I can get all this other information I don't
need, I can't seem to get the information I actually do need :) I've tried
querying Win32_Fan, Win32_TemperatureProbe, CIM_Sensor and
CIM_NumericSensor. It doesn't error out, but it consistently fails to
return any results. I think it may be a security issue? But not sure...

I'm going to post this response over to the WMI groups as well, in the hopes
that someone out there might have an idea. I can post my code if necessary
also (about 150 lines).

Thanks!
 
G

Guest

I tried to play with WMI to get the fan and probe info but got nothing from
attempt.
I used the WMI Object Browser from WMI Tools and the response was something
along the lines of there not being any instances.

However, I know my motherboard has sensors. I've used MSI's own monitor tool
as well as Speedfan which collected everything.

I also used pcpbios to dump out smbios info and there was no info on the
fans or probes. I thought I'd use WMI to get the raw smbios data and
enumerate through it based on the smbios spec and it showed the same info as
the pcpbios. In other words, no fan or probe info.
SMBios contained Types 0,1,2,3,4,5,6,7,8,9,11,12,13 (refer to the smbios
spec).

I think speedfan uses giveio.sys to get to the hardware info. I was
wondering if that is the only way. What is needed to get the info?

Thanks,
Nathan
 
M

Mike C#

Nathan said:
I tried to play with WMI to get the fan and probe info but got nothing from
attempt.
I used the WMI Object Browser from WMI Tools and the response was
something
along the lines of there not being any instances.

However, I know my motherboard has sensors. I've used MSI's own monitor
tool
as well as Speedfan which collected everything.

I also used pcpbios to dump out smbios info and there was no info on the
fans or probes. I thought I'd use WMI to get the raw smbios data and
enumerate through it based on the smbios spec and it showed the same info
as
the pcpbios. In other words, no fan or probe info.
SMBios contained Types 0,1,2,3,4,5,6,7,8,9,11,12,13 (refer to the smbios
spec).

I think speedfan uses giveio.sys to get to the hardware info. I was
wondering if that is the only way. What is needed to get the info?

Thanks,
Nathan

The general consensus seems to be that hardware vendors don't care to
provide us with a standardized interface, or standardized WMI drivers, for
retrieving fan speeds, voltages, CPU temp, etc. Doing it yourself appears
to involve a lot of painstaking research and corporate lawyers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top