WMI 疑难解答(可能为英文网页)WMI Troubleshooting

在应用程序或脚本中访问 WMI 本地或远程数据时,可能会遇到从缺少的类到拒绝访问的错误。When accessing WMI local or remote data in an application or script, you may encounter errors ranging from missing classes to access denied. 提供程序还提供调试选项和故障排除类。Providers also have debugging options and troubleshooting classes available.

备注

以下文档面向开发人员和 IT 管理员。The following documentation is targeted for developers and IT administrators. 如果你是最终用户,并且遇到有关 WMI 的错误消息,则应访问 Microsoft 支持部门 并搜索你在错误消息中看到的错误代码。If you are an end-user that has experienced an error message concerning WMI, you should go to Microsoft Support and search for the error code you see on the error message. 有关解决 WMI 脚本和 WMI 服务问题的详细信息,请参阅 Wmi 无法工作!For more information about troubleshooting problems with WMI scripts and the WMI service, see WMI Isn't Working!

WMI Diagnosis UtilityWMI Diagnosis Utility

从 Windows 8 和 Windows Server 2012 开始,不再支持 WMI 诊断实用程序 (WMIDiag.exe) 。The WMI diagnosis Utility (WMIDiag.exe) is no longer supported starting with Windows 8 and Windows Server 2012.

* * Windows 7、Windows Server 2008 R2、Windows Vista 和 Windows Server 2008: * ***Windows 7, Windows Server 2008 R2, Windows Vista and Windows Server 2008: **

如果 WMI 返回错误消息,则请注意,它们可能不表示 WMI 服务或 WMI 提供程序中的问题。If WMI returns error messages, be aware that they may not indicate problems in the WMI service or in WMI providers. 故障可能源自操作系统的其他部分,并通过 WMI 呈现为错误。Failures can originate in other parts of the operating system and emerge as errors through WMI. 在任何情况下,不要删除 WMI 存储库作为第一个操作,因为删除存储库可能会损坏系统或安装的应用程序。Under any circumstances, do not delete the WMI repository as a first action because deleting the repository can cause damage to the system or to installed applications.

若要获取有关问题来源的详细信息,可以下载并运行 WMI Diagnosis Utility 诊断命令行工具。To obtain more information about the source of the problem, you can download and run the WMI Diagnosis Utility diagnostic command line tool. 此工具将生成一个报表,该报表通常可以隔离问题源,并提供有关如何修复此问题的说明。This tool produces a report that can usually isolate the source of the problem and provide instructions on how to fix it. 该报表还协助 Microsoft 支持服务部门提供帮助。The report also aids Microsoft support services in assisting you. 您可以在 下载中心下载 WMI Diagnosis Utility。You can download the WMI Diagnosis Utility at the Download Center.

除非您正在编写 分离的提供程序,否则提供程序编写器也可能会遇到调试问题。Provider writers may also encounter debugging issues unless you are writing a decoupled provider. 有关详细信息,请参阅 调试提供程序For more information, see Debugging Providers.

日志记录和跟踪Logging and Tracing

WMI 日志文件不再存在;它们已替换 为 Windows (ETW) 的事件跟踪 The WMI log files no longer exist; they were replaced by Event Tracing for Windows (ETW). 有关详细信息,请参阅 跟踪 Wmi 活动记录 Wmi 活动wmi 日志文件For more information, see Tracing WMI Activity, Logging WMI Activity, and WMI Log Files.

脚本和应用程序中的疑难解答Troubleshooting in Scripts and Applications

WMI 包含一组类,用于对使用 WMI 提供程序的客户端应用程序 进行故障排除WMI contains a set of classes for troubleshooting client applications that use WMI providers. 有关详细信息,请参阅 WMI 客户端应用程序疑难解答For more information, see Troubleshooting WMI Client Applications.

提供程序编写器如何防止 WMI 问题How Provider Writers Can Prevent WMI Problems

通过执行以下操作,提供程序编写器可以防止许多问题,这些问题通过 WMI 出现在错误消息中:Provider writers can prevent many problems, which appear in error messages through WMI, by performing the following actions:

有关详细信息,请参阅 调试提供程序向 WMI 提供数据以及 提供程序配置和故障排除类For more information, see Debugging Providers, Providing Data to WMI, and Provider Configuration and Troubleshooting Classes.

拒绝访问Access Denied

访问 WMI 命名空间和数据的脚本和应用程序报告的访问被拒绝错误通常分为三个类别。Access Denied errors that are reported by scripts and applications that access WMI namespaces and data generally fall into three categories. 下表列出了三类错误以及可能导致错误和可能的解决方案的问题。The following table lists the three categories of errors along with issues that might cause the errors and possible solutions.

错误Error 可能的问题Possible Issues 解决方案Solution
0x800706BA HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)0x800706BA HRESULT_FROM_WIN32(RPC_S_SERVER_UNAVAILABLE)
防火墙问题或服务器不可用。Firewall issue or server not available.
计算机确实不存在 Windows 防火墙阻止连接The computer really doesn't exist The Windows Firewall is blocking the connection
正在连接到 Vista: netsh advfirewall 防火墙设置规则组 = "windows 管理规范 (wmi) " 新建 enable = yes 连接到下层:允许 windows 防火墙中的 "远程管理" 规则。Connecting to Vista: netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable=yes Connecting to downlevel: Allow the "Remote Administration" rule in Windows Firewall.
_ _ 拒绝访问 0x80070005 E0x80070005 E_ACCESS_DENIED
DCOM 安全拒绝访问。Access denied by DCOM security.
用户不能通过 DCOM 远程访问计算机。The user does not have remote access to the computer through DCOM. 通常,当使用不同的操作系统版本连接到远程计算机时,会发生 DCOM 错误。Typically, DCOM errors occur when connecting to a remote computer with a different operating system version.
为用户授予 dcomcnfg.exe 中的远程启动和远程激活权限。Give the user Remote Launch and Remote Activation permissions in dcomcnfg. 右键单击我的电脑 > "属性"。Right-click My Computer-> Properties. 在 "COM 安全" 下,单击这两个部分的 "编辑限制"。Under COM Security, click "Edit Limits" for both sections. 为用户指定要远程访问、远程启动和远程激活。Give the user you want remote access, remote launch, and remote activation. 然后,中转到 "DCOM 配置",查找 "Windows Management Instrumentation",并向用户提供要远程启动和远程激活的用户。Then go to DCOM Config, find "Windows Management Instrumentation", and give the user you want Remote Launch and Remote Activation. 有关详细信息,请参阅 在不同操作系统之间连接For more information, see Connecting Between Different Operating Systems
0x80041003 WBEM _ E _ _ 拒绝访问0x80041003 WBEM_E_ACCESS_DENIED
访问接口拒绝访问 Access denied by a provider
用户没有在 WMI 中执行该操作的权限。The user does not have permission to perform the operation in WMI. 如果将某些类作为低权限用户进行查询,则可能会发生这种情况,但在尝试调用方法或将 WMI 实例更改为低权限用户时,通常会发生这种情况。This could happen when you query certain classes as a low-rights user, but most often happens when you attempt to invoke methods or change WMI instances as a low rights user. 要连接到的命名空间已加密,并且用户正在尝试使用未加密的连接进行连接The namespace you are connecting to is encrypted, and the user is attempting to connect with an unencrypted connection
使用 WMI 控件授予用户访问权限 (确保将远程 _ 访问权限设置为 true) 使用支持加密的客户端进行连接。Give the user access with the WMI Control (make sure they have Remote_Access set to true) Connect using a client that supports encryption.
  • 通常,当使用不同的操作系统版本连接到远程计算机时,会发生 DCOM 错误。Typically, DCOM errors occur when connecting to a remote computer with a different operating system version.

  • 提供程序还可能拒绝访问特定命名空间中的数据,或者可能需要某些级别的连接安全。Providers may also deny access to data in specific namespaces or may require certain levels of connection security. 有关详细信息,请参阅 设置客户端应用程序的安全提供程序托管和安全性For more information, see Setting Client Application Process Security and Provider Hosting and Security.

  • 拒绝访问 Internet 连接防火墙中的错误 (ICF) 更改。Access denied errors from Internet Connection Firewall (ICF) changes.

    有关详细信息,请参阅 通过 Windows 防火墙连接For more information, see Connecting Through Windows Firewall.

  • 当低完整性客户端尝试访问 WMI 时,DCOM 安全将返回 "拒绝访问" 错误。An access denied error is returned by DCOM security when a low-integrity client tries to access WMI. 例如,在将安全级别设置为 "低" 的 Internet Explorer 中运行的 ActiveX 控件没有执行本地 WMI 操作的访问权限。For example, an ActiveX control that is running in Internet Explorer, which has the security level set to low, does not have access to perform local WMI operations.

    Windows 7: 低完整性用户对本地 WMI 操作具有只读权限。Windows 7: Low-integrity users have read-only permissions for local WMI operations.

有关错误的信息Information on Errors

如果从 WMI 收到错误消息,则可以在 Wmi 错误常量 中找到该消息,或在脚本编写 WbemErrorEnum中查找。When you get an error message from WMI, you can locate the message in WMI Error Constants or, for scripting, WbemErrorEnum. 但是,仅由错误提供的信息通常不足以确定发生的情况。However, the information supplied by the error alone is typically insufficient to determine what is happening. WMI 存储库损坏可能伪装为 "找不到" 类或实例。WMI repository corruption may masquerade as classes or instances "not found".

有关 WMI 错误的详细信息:For more information about WMI errors:

WMI 故障排除WMI Troubleshooting

跟踪 WMI 活动Tracing WMI Activity

记录 WMI 活动Logging WMI Activity