Error message when you open SQL Server Configuration Manager in SQL Server: "Cannot connect to WMI provider. You do not have permission or the server is unreachable"

Today while working on SQL Server configuration I faced this strange error.

Cannot connect to WMI provider. You do not have permission or the server is unreachable

I was running as administrator and I know SQL Server was running. Later I found a Microsoft KB article related to this issue. This issue is because “On a 64-bit computer, you install an instance of the 32-bit (x86-based) version of Microsoft SQL Server. On the same computer, you install an instance of the 64-bit version of SQL Server 2008. If you then uninstall the 64-bit instance, you receive the following error message when you open SQL Server Configuration Manager”

As a workaround Microsoft suggest to run the following command.

mofcomp “%programfiles(x86)%\Microsoft SQL Server[number]\Shared\sqlmgmproviderxpsp2up.mof”

Replace the number based on the version of SQL Server installed on your system.

Microsoft SQL Server 2012110
Microsoft SQL Server 2008 R2100
Microsoft SQL Server 2008100
Microsoft SQL Server 200590

Microsoft KB article - https://support.microsoft.com/en-us/kb/956013

Happy Programming :)