Search code examples
windowswindows-10wmi

Invalid query on "Win32_PerfFormattedData_PerfOS_Processor"


My software (with admin priviledges) periodically performs the following query via WMI to know the status of the CPU:

ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_PerfFormattedData_PerfOS_Processor");
ManagementObjectCollection collection = searcher.Get();

Suddenly (meaning after months where the result of searcher.Get() was always available) the command started sitting down and throwing an "Invalid query" Exception after a timeout. I cannot say what's changed in the machine before this happens.

I confirmed this error by testing it with tool wbemtest:

enter image description here

The error happens everytime, even after reboot. How can I debug it?

System is Windows 10 x64 IoT Enterprise v1607.


Solution

  • The solution is explained in this article.

    Anyway, I still have not understood the reason why the counters may get corrupted. Any comment on this?