2012-03-31 91 views
0

我想在远程计算机上运行查询(例如CIM_Memory),在这种情况下,它是虚拟机。我在Powershell中使用这段代码:Powershell远程计算机上的WMI查询

Get-WmiObject CIM_Memory -ComputerName IPADDRESS -Credential USERNAME 

当然带有一个实际的IP和用户名。 RemoteAdmin在两个操作系统上都启用(包括Win7)。

我得到这个异常:

Exception from HRESULT: 0x80070005 (E_ACCESSDENIED) 

因为它是与Win7的UAC功能,得到了用户的访问令牌。所以有这个注册表项:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ LocalAccountTokenFilterPolicy 

将此设置为1后,仍然得到相同的异常。可能是什么问题呢?

回答

0

您是否阅读过MSDN上的WMI Troubleshooting部分?以下是关于您的错误的内容:

0x80070005 – E_ACCESS_DENIED - Access denied by DCOM security.

The user does not have remote access to the computer through DCOM. Typically, DCOM errors occur when connecting to a remote computer with a different operating system version.

Give the user Remote Launch and Remote Activation permissions in dcomcnfg. Right-click My Computer-> Properties Under COM Security, click "Edit Limits" for both sections. Give the user you want remote access, remote launch, and remote activation. 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

0

强烈建议您启用ps远程处理,如果可以的话。这样,您可以告诉目标计算机运行本地wmi电话并向您报告。

当涉及防火墙,随机端口时,WMI存在大量问题。

相关问题