57

I cant open my SQL server configuration manager getting this error message:

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

I have searched online material and ran the mofcomp command as recommended: mofcomp “C:\Program Files (x86)\Microsoft SQL Server\120\Shared\sqlmgmproviderxpsp2up.mof”

I am now getting this error message:

MOF file has been successfully parsed
Storing data in the repository…
An error occurred while processing item 10 defined on lines 73 – 79 in file C:\Program Files (x86)\Microsoft SQL Server\120\Shared\sqlmgmproviderxpsp2up.mof:
Compiler returned error 0x80070005Error Number: 0x80070005, Facility: Win32
Description: Access is denied.

Can you please help me out, been 2 weeks sited with this problem

7
  • Can you ping the server? Has the SQL Server service on the server started?
    – SchmitzIT
    Commented Jun 26, 2017 at 5:54
  • @SchmitzIT yes I can ping the server and service is started. Just that I can not run my configuration manager because of the error message pasted above. Seems like its a common problem to SQL server users but cant figure this out.
    – Immortal
    Commented Jun 26, 2017 at 6:11
  • Try and run the WMI Diagnosis Utility: microsoft.com/en-us/download/details.aspx?id=7684. This seems to hint at an OS error. (I found an article for SQL Server 2008, showing the exact second error message you specified): support.microsoft.com/en-us/help/956035/…
    – SchmitzIT
    Commented Jun 26, 2017 at 6:39
  • Also take note that the command you use with mofcomp is version sensitive. What version of SQL Server are you running? If it's 2008, you need to replace \120\ with \100\, for instance
    – SchmitzIT
    Commented Jun 26, 2017 at 6:41
  • Thanks @SchmitzIT, I run the WMI Diagnosis utility and got this information: 49190 09:18:02 (1) !! ERROR: The following WMI repository file(s) is/are missing: ......................................................... 4 ERROR(S)! 49191 09:18:02 (0) ** - INDEX.BTR 49192 09:18:02 (0) ** - MAPPING1.MAP 49193 09:18:02 (0) ** - MAPPING2.MAP 49194 09:18:02 (0) ** - OBJECTS.DATA
    – Immortal
    Commented Jun 26, 2017 at 7:23

8 Answers 8

146

Run Cmd as Administrator and execute these commands:

First go to SQL Shared folder according to your sql version:

SQL 2008: 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\ -------> My version is 2017 SQL 2019: C:\Program Files (x86)\Microsoft SQL Server\150\Shared\

Find more versions here

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

Then:

mofcomp sqlmgmproviderxpsp2up.mof

Update:

The problem occurs because the Windows Management Instrumentation (WMI) provider configuration file for manage SQL Server services is missing. So the mofcomp command repairs or recreates it.

Here is more explanation: https://learn.microsoft.com/en-us/windows/desktop/wmisdk/mofcomp

6
  • @Arun Prasad E S Care to explain what the command does? Thanks!
    – Otto
    Commented Jun 25, 2019 at 16:03
  • 2
    thanks but guys make sure you cd program files (x86) , it make me wrong in first Commented Aug 17, 2019 at 18:40
  • Note: look for the version of the Management Studio not your sql server. As you know you may have different versions
    – SHADOW.NET
    Commented Aug 5, 2021 at 9:53
  • 1
    I think this is the best approach Commented Nov 15, 2022 at 1:38
  • 1
    in sql server 2022 i use mofcomp sqlmgmprovider.mof Commented Jan 13, 2023 at 14:40
11

Run the @Fereydoon Barkzehy codes with Administrative Access

Sample -

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

depends on where the file "sqlmgmproviderxpsp2up.mof" is present

Youtube video

1
  • 1
    And if that file isn't present in ANY of my Shared folders for any of my versions of SQL Server? :)
    – Tom H
    Commented Nov 7, 2019 at 16:17
3

The best solution for me was to uninstall the instance and reinstall a fresh instance. This worked 100%.

1
  • that did not succeed, but the accepted solution worked Commented Mar 18, 2019 at 1:24
1

I have the same issue but it is not working at first. Second I already restarted my PC but it is not working either. What I found out is that you will run this on the folder where your SQL Server Management Studio is installed and not on the MS SQL Instance folder.

My SQL Server Management Studio which is 2016 is installed in

C:\Program Files (x86)\Microsoft SQL Server\130

But I keep on running changing folder on which I installed on my SQL Server 2012 instance:

C:\Program Files (x86)\Microsoft SQL Server\110\Shared\

After that, just run the command: mofcomp sqlmgmproviderxpsp2up.mof as everyone suggest in here.

So keep it mind the folder since that may affect your troubleshooting.

1
  • Thank you. I had exactly the same problem. I have SQL server 2016 but running the command in folder \130 does not help. I have to run it in \110. I hope someone could shed some light on this.
    – Hong
    Commented Feb 3 at 22:36
0

What worked for me was to download the SQLEXPR_x64_Enu, run the Setup.exe and use the Repair option.

0

By trial and error I finally found this working solution:

  1. I searched all sqlmgmproviderxpsp2up.mof files under C:\Program Files (x86)\Microsoft SQL Server

  2. Running CMD as administrator I did for each result found above:

    i) Change directory to go to the directory

    ii) Run mofcomp sqlmgmproviderxpsp2up.mof

  3. Reboot

Then, it works.

0

doing a fresh OS installation also worked for me as well. but this is a pain. Sometimes you can run the:

“C:\Program Files (x86)\Microsoft SQL Server\120\Shared\sqlmgmproviderxpsp2up.mof”

Sometimes it helps and sometimes it doesn't, all you need to do is do a fresh OS installation and then SQL installation.

0
  1. Go to MSSql installation folder (C:\Program Files (x86)\Microsoft SQL Server\160)
  2. go to Shared folder and cmd with admin rights
  3. run "mofcomp sqlmgmprovider.mof" (make sure sqlmgmprovider.mof file is exists in the folder)
  4. Done. Now you can open the SQL Server Config manager as normally.

Not the answer you're looking for? Browse other questions tagged or ask your own question.