WMI query on a Remote Machine in Powershell

0

I want to run a query (for example CIM_Memory) on a remote computer, in that case it's a virtual machine. I use this code in Powershell:

Get-WmiObject CIM_Memory -ComputerName IPADDRESS -Credential USERNAME

Of course with an actual IP and Username. RemoteAdmin is enabled on both OS (both Win7).

I'm getting this exception:

Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)

Since it's Win7 with the UAC feature, the users get an access token. So there's this registry entry:

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

After setting this to 1, still getting the same exception. What could be the problem?

powershell
wmi
wmi-query
asked on Stack Overflow Mar 31, 2012 by Lgn • edited Apr 1, 2012 by JPBlanc

2 Answers

0

Did you read the WMI Troubleshooting section on MSDN? Here is what is said about your error:

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

answered on Stack Overflow Mar 31, 2012 by David Brabant • edited Mar 31, 2012 by Chris J
0

Highly recommend you enable ps remoting if you can. That way you can tell the target computer to run local wmi calls and report back to you.

WMI has loads of problems when it comes to firewalls, random ports.

answered on Stack Overflow Apr 1, 2012 by Elvar

User contributions licensed under CC BY-SA 3.0