Rebuilding WMI Repository
After having a bit of a struggle with Service Pack 1 for Team Foundation Server 2008, I had to restore a previous installation of Team Foundation Server 2005. After restoring the server, which runs on Virtual Server 2005 R2 everything seemed fine. It was only when trying to upgrade Team Foundation Server 2005 to 2008 that I received an error complaining about the WMI provider for SQL Server 2005.
Trying to look into this issue, I opened the SQL Server Configuration Manager and then received the following error:
“Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 servers with SQL Server Configuration Manager.
Initialization failure [0x80041014]“
This is not pretty. I went to Google the issue and discovered this post. It seems like the WMI repository corrupted when I did the restore. Nice. So, I followed the instructions detailed in the post, but no luck. It still returned with the same error that I received in the beginning.
The WMI Repository was corrupt in its entirety. How do you rebuild the WMI Repository? Not so easy it seems. Lukcily there is post describing the whole process with a neat little batch file that will rebuild the WMI Repository for you, came in very handy.
Note: Execute the following commands from this directory: C:\Program Files\Microsoft SQL Server\90\Shared
Here is the batch file duplicated for convenience:
net stop winmgmt c: 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
echo DONE pause
mofcomp sqlmgmproviderxpsp2up.mof
After performing the above steps, I rebooted the server and Team Foundation Server upgraded successfully.
by Sydney du Plooy

[...] the COM+ Catalog 19Aug08 After my post on rebuilding the WMI Repository, I thought it might be a good thing to write a post on rebuilding [...]
[...] rebuilding the required SQL Server 2005 mof file highly useful, it worked for me…here’s the post: http://thirdshelf.com/2008/08/13/rebuilding-wmi-repository/ Written by Deepak Vasa – Visit [...]
[...] http://thirdshelf.com/2008/08/13/rebuilding-wmi-repository/ [...]