Advertisement
BaSs_HaXoR

Fix WMI: Rebuilding the WMI Repository

Oct 17th, 2023
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. WMI: Rebuilding the WMI Repository
  2. Scenario Windows Management Instrumentation fails due to repository corruption or the repository is too large
  3.  
  4. The WMI Repository "%windir%System32\Wbem\Repository" is the database that stores meta-information and definitions for WMI classes; in some cases the repository also stores static class data as well. If the Repository becomes corrupted, then the WMI service will not be able to function correctly.
  5. If you suspect WMI or repository corruption, rebuilding repository is the last thing you should do. Deleting and rebuilding the repository can cause damage to the system or to installed applications. Other steps should be taken first to eliminate other possibilities or to confirm we have repository corruption. An extremely large Repository also creates problems and can sometimes be interpreted as a corrupt repository, which is not always the case. If issues are due to a large repository, rebuilding the repository is currently the only method available to reduce the repository size.
  6. It's a good idea to always capture a WMIDiag report for any WMI related issues:
  7. If WMI is corrupted, you can receive various errors depending on what activity was being accomplished at the time.
  8. Below are a few scenarios/errors that indicate repository corruption:
  9. Unable to connect to root\default or root\cimv2 namespaces thru wbemtest. Fails returning error code 0x80041002 pointing to WBEM_E_NOT_FOUND
  10. When we open Computer Management and Right Click on Computer Management(Local) and select Properties, you get the following error: "WMI: Not Found" or it hangs trying connect
  11. 0x80041010 WBEM_E_INVALID_CLASS
  12. Trying to use wbemtest, it hangs
  13.  
  14. a. Re-register all of the dlls and recompile the .mofs in the wbem folder and re-registering WMI Service and Provider. You can use the following script by saving to txt file then renaming to .bat and running from command prompt with admin right and changing focus to following directory: C:\Windows\System32\Wbem.
  15.  
  16. @echo off
  17. sc config winmgmt start= disabled
  18. net stop winmgmt /y
  19. %systemdrive%
  20. cd %windir%\system32\wbem
  21. for /f %%s in ('dir /b *.dll') do regsvr32 /s %%s
  22. wmiprvse /regserver
  23. winmgmt /regserver
  24. sc config winmgmt start= auto
  25. net start winmgmt
  26. for /f %%s in ('dir /s /b *.mof *.mfl') do mofcomp %%s
  27.  
  28.  
  29. b. Reboot the machine and test WMI
  30.  
  31. https://techcommunity.microsoft.com/t5/ask-the-performance-team/wmi-rebuilding-the-wmi-repository/ba-p/373846
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement