Search code examples
c++wmi

Why is there no WMI instance for Win32_Fan, when I do have a fan?


I am using WMI to monitor certain hardware metrics, and specifically, I am using WMIExplorer.exe to find WMI classes and their instances(link to WMIExplorer.exe download: https://www.bleepingcomputer.com/download/wmi-explorer/). When I try to retrieve instances of the Win32_Fan class within the Root\cimv2 namespace, I get 0 instances. I am wondering why this is, since I do have a fan in my laptop. Do some fans/pieces of hardware not support retrieval through the WMI interface?

Note that I also tried the "Get-WmiObject -query "SELECT * FROM Win32_Fan" command in PowerShell to confirm there are no instances; there was no output from this command. I am simply wondering if there's any cause of an instance not showing up other than the hardware simply not being compatible with WMI. Or are there alternatives to finding fan speed without downloading third-party applications?(I want to get the fan speed within a personal C++ program).


Solution

  • Win32_Fan instances are provided by Windows\System32\wbem\cimwin32.dll. If you disassemble it you will see that it reads SMBIOS data (specifically entries with type 27) to get fan device information. So having no such instances means your system manufacturer did not write fan device info into SMBIOS, which is part of ROM.