Recently I switched my database over to SQL Server, which led me to use Microsoft’s SQL Server Management Studio. During the installation process I ran into a WMI Service Error; something I never faced before. This is how I fixed this error and continued on with the SQL Server setup installation.
So assuming you Google searched your way over to here, I’m guessing you have a Windows Management Instrumentation (WMI) service failed error. If you do great, you may have come to the right place.
(Disclaimer: Try these steps at your own risk. What worked for me, might not work for you. I solved my issue with a series of tutorials that may or may not have contributed to this fix. I’m also not a computer genius, half of the time I had no idea what would happen. All I know is that these steps eventually worked. So proceed with this in mind.)
WMI Service Error… you suck!
During the ‘Global Rules’ stage of your setup, you notice that your Windows Management Instrumentation (WMI) service has failed and you cannot continue until the the failure is corrected.
What does this mean? Well, it can be caused from one or more issues on your local computer (corrupted files, an incomplete install or uninstall of a program, improper deletion of hardware, etc.).
By clicking on the ‘Failed’ link we can see detailed information. This message doesn’t give us any surprising information.
After a quick Google search, I managed to locate where to find the WMI service on my local computer. Here is the full path starting from the Control Pannel:
Control Pannel > System and Security > Administrative Tools > Services > scroll down to Windows Management Instrumentation
Once I located the WMI service, I noticed that the status was set to Running…
I found this to be strange since it appears to be running just fine. So why am I getting a WMI Service Error?
I checked the properties by double clicking (or right-click > properties) and checked the Dependencies tab…
Well there’s our problem. A propertly working WMI should look like this.
(Note: If your error box says “WMI: Initialization failure” take a look at this quick fix tutorial)
With a quick Google search, I came across a Microsoft blog post about rebuilding the WMI repository.
The first action they recommend to do is “Re-register all of the dlls and recompile the .mofs in the wbem folder and re-registering WMI Service and Provider”. (Whatever that means…sure, I’ll give it a try) To do this we first must create a batch file to run in the admin command prompt.
Copy the following script and paste it into notepad. Then save the file in a familiar location with the name WMI-repo-register.bat . Make sure when you save the file, you select ‘All Files’ in the ‘Save as type’ select dropdown.
sc config winmgmt start= disabled
net stop winmgmt /y
for /f %%s in (‘dir /b *.dll’) do regsvr32 /s %%s
sc config winmgmt start= auto
net start winmgmt
for /f %%s in (‘dir /s /b *.mof *.mfl’) do mofcomp %%s
Now open your command prompt (as admin) and CD to the following path; C:\Windows\System32\Wbem (chances are you’re already there when you start up CMD). Now run the file you just created in the command prompt.
Once the script completes, restart your computer and run winmgmt /verifyrepository in your command prompt. This will check the repository for consistencies.
If you get a more successful response than the one above, try running the SQL Server installation/setup again and see if the ‘Global Rules’ step passes. If you got the same response I got, continue on with the tutorial.
Next I tried resetting the WMI repository by running Winmgmt /resetrepository in the command prompt.
Great another error… Something is blocking me from running the command. Thanks to a blog post by Robin at Fixing Things, there is a way to force a reset repository command.
Open up Windows Powershell as an admin and type the following in the command line…
Stop-Service winmgmt -Force; winmgmt /resetrepository
After the command completes, reboot your computer.
I then ran the SQL Server installation/setup and WMI services finally passed! (Forgot to take a screenshot during my excitement)
If you run into any other issues later on in the installation, (most likely in the Feature Rules) read the error and download whatever you may be missing. In my case, I was missing Microsoft .NET Framework 3.5 Service Pack 1…. so I just downloaded the pack right from Microsoft and was allowed to proceed.
I hope this tutorial helps you solve your Windows Management Instrumentation (WMI) service error. If you ran into a similar issue and found a different solution that worked for you, please post a link or suggestion in the comments below.
Thanks for reading!