Recently I started experiencing WMI repository corruption that results in inability to open SQL Server Configuration Manager with the following 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 class [0x80041010]
At this point if I browse WMI repository under root\microsoft\sqlserver\computermanagement11 I see no SQL Server-specific classes. Only system classes exist. To resolve this issue SQL Server WMI provider needs to be reinstalled.
Step 1 - Install classes
Navigate to C:\Program Files (x86)\Microsoft SQL Server\<SQL Server version, for example "100" for SQL Server 10>\Shared if you have x64 installation of SQL Server. On x86 machine the path is C:\Program Files\Microsoft SQL Server\<SQL Server version, for example "110" for SQL Server 11>\Shared. Make sure that file sqlmgmproviderxpsp2up.mof exists. If it doesn't then either you're in the wrong location or your installation is corrupted and only SQL Server setup can fix the problem. However if the file does exist, then resolution is as simple as running command: mofcomp sqlmgmproviderxpsp2up.mof
c:\Program Files\Microsoft SQL Server\100\Shared>mofcomp sqlmgmproviderxpsp2up.mof
The output will look like below:
Microsoft (R) 32-bit MOF Compiler Version 5.1.2600.2180
Copyright (c) Microsoft Corp. 1997-2001. All rights reserved.
Parsing MOF file: C:\Program Files\Microsoft SQL Server\Shared\sqlmgmprovider
xpsp2up.mof
MOF file has been successfully parsed
Storing data in the repository...
Done!
WMI compiler will notify you that repository was successfully updated
Step 2 - Install localization information
After the classes are deployed localization information needs to be installed as well. From the path in the previous step navigate to the sub-folder that reflects the locale of SQL Server installation. For example 1033 (for english-US). Full path is now C:\Program Files (x86)\Microsoft SQL Server\<SQL Server version, for example "110">\Shared\<locale ID, for example "1033" for english>. When at this path run the following command:
mofcomp sqlmgmprovider.mfl
WMI resopitory should have been updated successfully again.
如果还是没能解决,可能是管理员(administrator)没有 network service的权限,所以 WMI无法打开。 设置的方法很简单,网络上都有:
1 右击“我的电脑”-->“管理”
2 在“本地用户和组”内的Administrators组上双击,出现添加属性对话框。
3 单击“添加”按钮,出现添加用户对话框
4 单击“高级”按钮,再单击“搜索”(或是“立即查找”)按钮。注:此'NT AUTHORITY\NETWORK SERVICE'用户为系统内置帐户,无法直接添加。
5 在“搜索结果”内选择“Network Service”用户后,单击“确定”
按照以上的步骤设置之后,进入配置管理器,问题依旧出现……到了这里实在让人郁闷的不行。
这时又看到一个新方法:检查一下 windows下的system32 中是否有framedyn.dll这个系统文件,如果没有到system32 下的wbem文件中拷贝framedyn.dll到system32 目录下。 我进到system32目录找framedyn.dll文件,果然没有找到,再进入system32\wbem目录,找framedyn.dll,拷贝到system32目下。再次进入配置管理器,这次终于成功了!!!问题终于解决了!!!这主要是通过Java 或者vc连接数据库遇到的问题。
以上所述三种方法,总是一个在有些人的电脑上可以起作用。我很不幸尝试到第三种方法才解决了问题,也有可能这三个操作在我的电脑上都是需要的。