WMIDiag.vbs - WMI Diagnostic Script + WMI Fixer

Posted at

A utility to help system administrators diagnose and repair problems with the WMI service.


WMIDiag.vbs is a VBScript script designed to help you ascertain the current state of the WMI service on a computer. The download package includes the utility itself, a ReadMe file that discusses how the tool works (and how to best use it), and sample spreadsheets that provide information about the default WMI configuration on various versions of the Microsoft Windows operating system.

The huge (almost 6MiB) visual-basic script can be downloaded from The GitHub Project (Mirror).

- Download the vbs script to your desktop or better-yet, a flat (with no spaces) directory path (such as C:\\wmifix\\ or something...)
- open command-prompt (CMD) as administrator and run cscript.exe WMIDiag.vbs.

- Expect a similar output:

- When done, M$-Windows-notepad will pop-up with the log file...

- Do You Want To Fix Your WMI Repository/Re-Register DLLs/Repair The Service?
- - Set either set TARGET=%windir%\\system32\\wbem or
set TARGET=%windir%\\SysWOW64\\wbem
- - Run This Script (copy to text file name_me_whatever.cmd),
- - right click, and run as administrator.
@echo off

:: --------------------------------
:: --------------------------------
:: -  SELECT x32 or x64 VERSION   -
:: --------------------------------

::set TARGET=%windir%\\system32\\wbem
set TARGET=%windir%\\SysWOW64\\wbem

::--------------------------------------------------------Service STOP
sc config winmgmt start=disabled
net stop winmgmt /y

::--------------------------------------------------------DLL Register
for %%e in (*.dll) do (
  call regsvr32 /s "%%e"

::--------------------------------------------------------Service START
call %TARGET%\\wmiprvse.exe /regserver 
call %TARGET%\\winmgmt.exe /regserver 
sc config winmgmt start=auto
net start winmgmt

::--------------------------------------------------------Repository Rebuild
for %%e in (*.mof) do (
  call mofcomp "%%e"

for %%e in (*.mfl) do (
  call mofcomp "%%e"