2012-03-31 92 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存在大量問題。

相關問題