WMI Repair

(imported topic written by MBARTOSH)

Has anyone written a fixlet to repair WMI?

(imported comment written by milhouse91)

We use the following, which is basically a batch file distributed and run using TEM. Its quick to run but can take a while for all the properties to update depending on the evaluation cycle. Its also important to note that this script wont restart services that depend on WMI. I’ve been meaning to add this piece but just havn’t had time.

Also i have removed some extra “house keeping” code from the below but it still should work.

delete wmifix.bat

delete __createfile

createfile until



if not exist “c:\temp” md “c:\temp”

cd /d c:\temp

if not exist c:\windows\system32\wbem goto TryInstall

cd /d c:\windows\system32\wbem

net stop winmgmt /y

winmgmt /kill

if exist Rep_bak rd Rep_bak /s /q

rename Repository Rep_bak

for %%i in (*.dll) do RegSvr32 -s %%i

for %%i in (*.exe) do call :FixSrv %%i

for %%i in (.mof,.mfl) do Mofcomp %%i

net start winmgmt

goto End


if /I (%1) == (wbemcntl.exe) goto SkipSrv

if /I (%1) == (wbemtest.exe) goto SkipSrv

if /I (%1) == (mofcomp.exe) goto SkipSrv

%1 /RegServer


goto End


if not exist wmicore.exe goto End

wmicore /s

net start winmgmt



move __createfile wmifix.bat

waithidden wmifix.bat

(imported comment written by MBARTOSH)

This is great. Thank you. Have you come up with any relevance to determine whether or not wmi is broken?

(imported comment written by milhouse91)

We check for wmi

“exists wmi”

and also run a wmi query to see if it works. On this occassion we use the domain check

“not exists string values of selects “Domain from Win32_ComputerSystem” of wmi”

Seems to work well for us.

(imported comment written by SystemAdmin)

Based on this discussion, i’ve combined it all into a downloadable fixlet.


(imported comment written by MBARTOSH)

Here is the relevance for checking for broken WMI. "not exists wmi | true’