Sunday, January 18, 2009

MS: Rebuild WMI

To rebuild WMI in a Windows Server 2003 run this script:

--- Rebuild_WMI.cmd ---

net stop winmgmt
cd %systemroot%\system32\wbem
rd /S /Q repository
regsvr32 /s %systemroot%\system32\scecli.dll

regsvr32 /s %systemroot%\system32\userenv.dll
mofcomp cimwin32.mof

mofcomp cimwin32.mfl
mofcomp rsop.mof
mofcomp rsop.mfl
for /f %%s in ('dir /b /s *.dll') do regsvr32 /s %%s
for /f %%s in ('dir /b *.mof') do mofcomp %%s
for /f %%s in ('dir /b *.mfl') do mofcomp %%s

--- Rebuild_WMI.cmd ---

To rebuild WMI in Citrix Servers:

Optional step: remove Citrix WMI

Remove Citrix WMI component using Add/Remove Program
Reboot server
Install Citrix WMI component using Add/Remove Program

Rebuild WMI:

cd %programfiles%\citrix\system32\citrix\wmi
for /f %s in ('dir /b *.mof *.mfl') do mofcomp %s

1 comment:

Kunalee said...

I had two Citrix servers that I wasn't able to install any new software, after some digging WMI was the problem.

This worked great for me. I tried other rebuild scripts you find more often, but they only reduced my errors. Thanks for putting this together and posting it.