Windows WMI errors fix.
Fixes the error "unable to connect to WMI namespace" or,  wbemtest.exe connecting to root\cimv2 gives an error code 0x80041002

  1. Check if the Windows Management Instrumentation Service is disabled
  1. If it is, ensure it is enabled and set to Automatic, then run checks again.
  • If the above doesn't resolve the error, please see below:
    • This error is caused by a corrupted Windows Management Instrumentation (WMI) repository on the device.
    • Review steps/run the following commands in Administrative Command Prompt on the affected device to check, and repair the WMI repository:

      1. winmgmt /verifyrepository
        • This checks on the status of the repository.
        • If it comes back as inconsistent or you receive any other errors do step 2.

      1. winmgmt /salvagerepository
        • This tries to repair the existing repository

      1. winmgmt /verifyrepository
        • We are checking to see if the salvage repository was successful. If not proceed to step 4.

      1. Run Microsoft's WMI Diagnosis Utility and further troubleshoot the issue. You can download WMI Diagnosis Utility from the Microsoft Download Center.

      1. Winmgmt /resetrepository
        • This will reset and rebuilt the repository to the original state, when the OS was first installed
  • If you get the following error or similar Error: "WMI Reset Failed" , "A Stop Control has been sent to a service that other running services are dependent on.", then run these commands:
    • net stop winmgmt /y
    • winmgmt /resetrepository