Been struggling with this for a couple days now.

I'm getting the following error:

PS C:\> get-process -ComputerName Win2012r2
get-process : Couldn't connect to remote machine.
At line:1 char:1
+ get-process -ComputerName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-Process], InvalidOperationException
    + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetProcessCommand

I have confirmed that the Remote Registry service is running on the server (I also tried restarting it).

Additionally, I've created a custom firewall rule to allow RCP connections on ports 5985 && 5986 per https://stackoverflow.com/questions/22357063/get-process-to-remote-computer-doesnt-work-but-invoke-command-does

I've also double checked the usernames per Powershell Get-Process cannot connect to remote computer


invoke-command -ComputerName Win2012r2 -ScriptBlock {Get-Process} works fine, but I really need to get the get-process -computername process to work directly since it's failing inside another script that is used by others


I finally gave up and wrote a new script that uses the following rather than calling Get-Process directly:

invoke-command -ComputerName Win2012r2 -ScriptBlock {param($procName) Get-Process -Name $processName} -ArgumentList $ProcName
  • Shouldn't it be param($processName) – Christian Nov 30 '18 at 10:30

I had a similar error when I started to teach myself PS2 on Win7 client testing LocalHost. I resolved it by starting the Remote Registry service.

  • 2
    As mentioned in the question, the remote registry service is confirmed running. Thanks though – StormeHawke Aug 30 '15 at 15:44

-ComputerName in Get-Process uses RPC, not WinRM. WinRM is what uses 5985 and 5986, not RPC.

RPC ports are dynamic by default.

Check the "Get-Help" of Get-Process.

-ComputerName This parameter does not rely on Windows PowerShell remoting. You can use the ComputerName parameter of Get-Process even if your computer is not configured to run remote commands.

Invoke-Command DOES use WinRM. So when you changed your code to use Invoke-Command, your script started working.


Try using this instead:

get-wmiobject -class win32_process -computername pcname -filter "Name = 'procname'"


The only thing I can think of is that either the account you're running this under doesn't have admin rights on the target (Win2012r2), or that the firewall is blocking it. Try disabling the firewall completely to test the latter.

  • Tried disabling the firewall already, and invoke-command works fine so account is working – StormeHawke Jul 23 '14 at 11:16
  • I assume the server is Win2012R2 (hence the name), but what is the client? Have you tried starting the PS console with Run As Administrator? Anything in the Event Logs at either end? Especially in the Security log of the server? – DarkMoon Jul 23 '14 at 11:26

Have you verified that your DNS resolution is working? Might try nslookup to verify that you are resolving to the correct IP.

Check out this post. This looks like an answer to your problem. Try turning off the firewall on both systems and use get-process. If it then works you will know that you need to open the ports that are mentioned in this post.


  • Yes, I pinged the machine with no trouble. Also as mentioned in the question invoke-command works so the day can't be the problem. If I specify an IP address to get-process it still fails. – StormeHawke Jul 23 '14 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.