Getting 'Invalid WMI query' with error code 0x80041017 in Windows

Getting 'Invalid WMI query' with error code 0x80041017 in Windows

"Invalid WMI query" with error code WBEM_E_INVALID_QUERY (0x80041017) found in log files or script execution when collecting Windows performance counter data.

It is possible that the Win32_PerfRawData_PerfOS_Processor cannot be found or accessed on the server and causing a null result. If the same query runs and retrieves values from other similar Windows systems at the same OS level this indicates that the query is correct and something is different at the OS level causing the query not to retrieve data.
This is a often due to a Microsoft bug.

Number: 0x80041017
Facility: WMI
Description: Invalid query when collecting Windows performance counter data

Root Cause :
The following are the possible reasons and resolution.
  1. Missing WMI classes 
    1. RESOLUTION :
      In some cases, as per KB 93113 running the following command in the Windows' command line (CMD) may solve the problem of missing WMI classes.
      %windir%\system32\wbem\wmiadap.exe /f
      This command parses all the performance libraries on the system and refreshes the Performance Counter Classes. For further details see Windows Management Instrumentation Documentation.
  2. Broken performance counters.
    1. RESOLUTION :
      Rebuild the Performance Counters using the "lodctr /r" command as per KB 185319. Additional information can be found on solution 2554336 from the Microsoft Knowledge Base.
  3. In the registry, the performance counters are disabled.
    1. RESOLUTION :

      The registry key “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\PerfProc\Performance” or “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\PerfDisk\Performance” is set so that “Disable Performance Counters” is set to 1, which means it is disabled.

      Users can manually change the registry key to "0" or they can use the Extensible Counter List Tool as described in this Microsoft blog titled "Two-Minute Drill: Disabled performance counters and Exctrlst.exe" to enable the Performance Counters in the Operating System. The registry change happens immediately.

      If the "Disable Performance Counters" registry key is not present then the Performance Counters have not been disabled at the registry key here.

      Note: AppManager Support does not provide support for problems that arise from improper modification of the registry. The Windows registry contains information critical to your computer and applications. Make sure you back up the registry before modifying it. For more information on the Windows Registry Editor and how to back up and restore it, refer to Microsoft Article ID 256986 “Description of the Microsoft Windows registry” at Microsoft Support.
  4. The columns returned by the WMI class are incomplete or unexpected. This error can indicate that the query returned a null value. Therefore the script can't continue and will throw the error code 0x80041017.
    1. RESOLUTION :
      Please contact your Microsoft support team to recreate the WMI class properly. Additional information can be found on solution 961435 from the Microsoft Knowledge Base.
      NOTE: A restart of the system may be required after applying the suggested solutions.



                    New to ADSelfService Plus?

                      • Related Articles

                      • WMI Error Troubleshooting Guide

                        WMI Error Troubleshooting Guide Overview This Knowledge Base provides troubleshooting guidance for commonly encountered Windows Management Instrumentation (WMI) errors that may occur while adding a Windows monitor or collecting metrics through WMI ...
                      • Configuring non-admin user account for WMI monitoring

                        By default, Windows allows only members of the Administrators or Domain Admin groups to read WMI class information. However, you can configure a regular user to access WMI information by performing the following steps on the server that needs to be ...
                      • Setting WMI access through Active Directory and Group Policy Object for non-admin user

                        In our case, we run Active Directory on Windows 2008 R2 and we want to scan the target machine which is Windows 2012 R2 machine. Our domain is called “APMCLU” and we name our dedicated WMI user-account “wmiuser”. First – Setting done from Active ...
                      • Troubleshooting Basic WMI Connection

                        Troubleshoot Basic WMI connectivity If you're using Applications Manager version 15470 or above, navigate to Admin > Self Help Tools and select the monitor type to troubleshoot the issue. Click here for more details. If you encounter an error in the ...
                      • "The RPC server is unavailable" error message displayed while adding or monitoring Windows server through WMI mode.

                        Here are a few methods to resolve an error : Try adding the server using domain name if the server is in a domain Try adding the server using name if the server is in a workgroup. If the server is in a DMZ, add the ipaddress and hostname in the ...