Recently when I tried to install SQL server on my new laptop, I got an error as per below details

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

The error occured becasue I had installed two verions of SQL server in the same pc, 32 & 64 bit version and then later i uninstalled 32 bit version and then tried to open SQL server configuration manager, so in this post I am going to provide your details on how to solve this error.


Solution for SQL server configuration manager cannot connect to wmi provider error

To resolve this error, open cmd prompt as administrator (Otherwise you may get access rights issue, so always open it as administrator ), and navigate to Navigate to your SQL version’s shared directory, here are the possible list of location based on your SQL server version

SQL 2008:     C:\Program Files (x86)\Microsoft SQL Server\90\Shared\
SQL 2008 R2:  C:\Program Files (x86)\Microsoft SQL Server\100\Shared\
SQL 2012:     C:\Program Files (x86)\Microsoft SQL Server\110\Shared\
SQL 2014:     C:\Program Files (x86)\Microsoft SQL Server\120\Shared\
SQL 2017:     C:\Program Files (x86)\Microsoft SQL Server\140\Shared\

So, if you are using SQL server version 2017, your cmd command would be

C:\WINDOWS\system32>cd "C:\Program Files (x86)\Microsoft SQL Server\140\Shared"

and then run the command "mofcomp sqlmgmproviderxpsp2up.mof" as shown below

C:\Program Files (x86)\Microsoft SQL Server\140\Shared>mofcomp sqlmgmproviderxpsp2up.mof

that's it you are done, you should get output as below.


After you run the Mofcomp tool, restart the WMI service for the changes to take effect. The service name is Windows management Instrumentation.

Note: For this command to succeed, the Sqlmgmproviderxpsp2up.mof file must be present in the %programfiles(x86)%\Microsoft SQL Server\number\Shared folder.