Powershell Get-Process : Couldn’t connect to remote machine

powershellremote-access

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 10.10.1.54
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + 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

Note

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

Best Answer

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.

Related Topic