I wanted to install Ola Hallengren’s SQL Server Maintenance Solution on my lab’s Windows Server Update Services (WSUS). When I tried to install Ola’s script, unfortunately, I received an error message saying that the SQL Server Agent service wasn’t running. I thought this was an easy fix: just enable it! When I launched SQL Server 2016 Configuration Manager, however, I received another error message. This message read, “Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 and later servers with SQL Server Configuration Manager. Invalid namespace [0x80041010].”
I did a lot of digging and more digging. Eventually, I found out that I was receiving this error message because the x86 WMI provider was not installed on the SQL Server. That problem became the reason for this blog post. Here, I show you how to install the SQL Server WMI provider.
Installing the SQL Server WMI Provider
On your SQL Server, open an elevated CMD prompt.
Change the directory to:
%programfiles(x86)%\Microsoft SQL Server\SQL Server Version #\Shared
The SQL Server Version # is based on the SQL Server name installed on the computer. See the table below for more information.
wdt_ID SQL Server Name SQL Server Version # 1
Microsoft SQL Server 2017
Microsoft SQL Server 2016
Microsoft SQL Server 2014
Microsoft SQL Server 2012
Microsoft SQL Server 2008 R2
Microsoft SQL Server 2008
Microsoft SQL Server 2019
Microsoft SQL Server 2005
Next, confirm that the WMI MOF file is present. Use the dir *.mof command to confirm that the sqlmgmproviderxpsp2up.mof is listed within the directory. If it is not there, you have bigger problems. Unfortunately, if that’s the case, this blog post will not help you.
Next, execute the command mofcomp sqlmgmproviderxpsp2up.mof. This command compiles the MOF and adds it to WMI. If everything is successful, you should receive the success message noted below. If not, you need to troubleshoot why this failed.
Microsoft (R) MOF Compiler Version 6.3.9600.16384
Copyright (c) Microsoft Corp. 1997-2006. All rights reserved.
Parsing MOF file: sqlmgmproviderxpsp2up.mof
MOF file has been successfully parsed
Storing data in the repository…
Reboot the Server
At this point, you need to restart WMI, BUT I like to reboot the server first in order to ensure that everything is correct and that nothing is still cached in memory. It takes a few minutes longer to reboot the server first, but again, IMO it helps by eliminating other unknown issues. You could, however, simply restart the WMI service if you don’t want to take this extra step.
Once my server rebooted, I changed the SQL Server Agent setting. Doing so allowed me to complete the installation of Ola Hallengren’s script on my lab’s WSUS.
If you have any questions about how to install the SQL Server WMI provider, please feel free to contact me @GarthMJ.