Applications Systems

Windows Service Monitor returns 'Invalid Query'

The Windows Service Monitor fails with the following error: Invalid Query. To resolve, you may need to check the following WMI classes: Win32_service and Win32_PerfRawData_PerfProc_Process or rebuilding performance counters.

First published date

10/10/2018 6:19 PM

Last published date

6/11/2021 3:38 PM

Overview

The Windows Service Monitor fails with one of the following errors:

  • Invalid query
  • Invalid class

The following Windows Management Instruments (WMI) classes are used by SAM for Windows Service Monitor:

  • Win32_Service - To monitor the status of the service.
  • Win32_PerfRawData_PerfProc_Process - To monitor the use of resources (CPU and memory).
  • Win32_Process

As part of the resolution, you may need to rebuild the performance counters. Information is provided in the resolution steps.

Product section

Server Application Monitor

Cause

The issue is caused when the following Windows Management Instruments (WMI) class is missing:

Win32_PerfRawData_PerfProc_Process 

Resolution

Resolution 1:

  • Restart the WMI service.
Resolution 2:
  • Reregister PerfMonCounters and WMI classes:
  1. Open an elevated CMD
  2. Reregister the PerfMonCounters and WMI Classes.
    1. Open an elevated CMD window on the target system.
    2. Go to the following directory:

      cd c:\windows\sysWOW64\
      or
      cd c:\windows\system32

    3. Type the following commands (first one for PerfCounters, second cmd for WMI classes):
      lodctr /R
      wmiadap.exe /f
  1. If the WMI class is still missing, ensure that the following value is set to zero and not a value of one. Value of one means the performance counter class will be disabled and Orion poller will be unable to poll the server.
    KEY: “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\PerfProc\Performance”
    Field: “Disable Performance Counters”
    Value: 0
  1. If the entry is found and the value set to 1, set it to 0 and reboot the system.

You may also need to rebuild the performance counters. For information and instructions for rebuilding performance counters, see this Microsoft KB Article for Windows 2008 : (© 2018 Microsoft, available at  https://support.microsoft.com, obtained on December 22, 2018). Please note: This is a third-party link that may change.

* Please Note: This workaround has resolved this Error Message for a number of customers but if the above solution does not work on your Device we will require you to reach out to Microsoft for further troubleshooting as to why the class is not being provided by WMI. 


Disclaimer: Please note, any content posted herein is provided as a suggestion or recommendation to you for your internal use. This is not part of the SolarWinds software or documentation that you purchased from SolarWinds, and the information set forth herein may come from third parties. Your organization should internally review and assess to what extent, if any, such custom scripts or recommendations will be incorporated into your environment.  You elect to use third party content at your own risk, and you will be solely responsible for the incorporation of the same, if any.