Tuesday, November 30, 2010

How to repair and re-install WMI on a Windows 2003 server

We need to restart the server if we do a repair or reinstall of the WMI. We repair WMI components on the server and if it does not work, then reinstall and restart the server.

We need to follow the below steps in order to Repair WMI :-

1> Open a command prompt window (Run as Administrator) and change directory (cd) to %windir%\System32\wbem on 32bit Windows or %windir%\SysWOW64\wbem on 64bit Windows

2> Run both these commands one at a time-

a> FOR %i in (*.dll) do RegSvr32 -s %i
b> FOR %i in (*.exe) do %i /RegServer
c> FOR /f %s in ('dir /b /s *.dll') do regsvr32 /s %s

3> Net stop /y winmgmt

4> FOR /f %s in ('dir /b *.mof *.mfl') do mofcomp %s

5> Net start winmgmt

We need to verify by running any WMI query to check if the WMI is working on the server or not. If the issue is still not resolved, then we need to use the following command to detect and repair a corrupted WMI Repository:

a> rundll32 wbemupgd, RepairWMISetup
b> we need restart the server.



We need to verify by running any WMI query to check if the WMI is working on the server or not. If the issue is still not resolved, then we need to perform the Comprehensive Rebuild Method.

Important note: If you've installed a Service Pack, you need to insert your Windows XP CD with Service Pack integration (called as the Slipstreamed Windows XP CD). If you don't have one, you may point to the %Windir%\ServicePackFiles\i386 folder for a recent version of the system files required during WMI repair. Or you may create a slipstreamed Windows XP CD and insert it when prompted.

Click Start, Run and type the following command, and press ENTER:

1> rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf

Insert your Windows XP CD into the drive when prompted. Repair process should take few minutes to complete. Then restart Windows for the changes to take effect.
 
 
Hope this helps someone.