Tuesday 25 September 2012

SQL Server Installation error due to WMI Services

Today I had a chance to work on a SQL Server Installation failure due to WMI services cannot be started. It was really interesting to work with, So thought of sharing it. 

Error




Reason
The WMI Services on the sevices.msc shows that it is running, when we right clicked on Windows Management Instrumentation services-->Dependencies I have got the error as "WMI: Initialization Failure". It shows clearly that WMI have got corrupted.
 
Possible Fix
Since the WMI has got corrupted, we can try reinstalling the WMI components. Let us see how we can do that.


Step-1
Copy the following command in a notepad and save it as "REINSTALL_WMI.bat"

@echo on
cd /d c:\temp
if not exist %windir%\system32\wbem goto TryInstall
cd /d %windir%\system32\wbem
net stop winmgmt
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
:FixSrv
if /I (%1) == (wbemcntl.exe) goto SkipSrv
if /I (%1) == (wbemtest.exe) goto SkipSrv
if /I (%1) == (mofcomp.exe) goto SkipSrv
%1 /RegServer
:SkipSrv
goto End
:TryInstall
if not exist wmicore.exe goto End
wmicore /s
net start winmgmt
:End

Step-2

Execute the script, while it is getting executed it will show the dependent services for the WMI services and it prompts whether to continue with the Reinstallation operation or not. Proceed with Y if you want to continue.




Once the operation completes the command window closes automatically. Reboot the server and tried with the SQL Server installation and it worked!!! SQL Server Installation went on well and handed over the system to the user.



Reference
There is a blog Post in MSDN Forum which was really helpfull to work with this issue.
 


No comments:

Post a Comment