Get-Process - Couldn't Connect to remote machine


  • Just started using PS, trying to script a health check to various terminal servers.  Most work okay, but when trying to do Get-Process on one of them, I get:

    Get-Process: Couldn't connect to remote machine
    At line: 1 char:12
    + get-process <<<< -computername thecompname
         + CategoryInfo : Not Specified (:) [Get-Process], InvalidOperationException
         + FullyQualifiedErrorId: System.InvalidOperationException,Microsoft.PowerShell.Commands.GetProcessCommand

    I've already looked online and did the following troubleshooting:
    Enable Remote Registry (was already enabled, tried stopping and re-starting)
    Enable-PSRemoting -Force
    Invoke-Command {get-process} -computer thecomputername (Worked as expected)
    Get-EventLog -computername thecomputername (application log, testing to make sure WMI connections worked, was able to retrieve event log)
    Tried remote registry changes, worked fine

    This group of servers I'm running the script against all were built with same template/instruction set, so I can't figure out what to check that would be different.

    Any ideas?

    Monday, August 22, 2011 6:02 PM

All replies

  • most of those steps wont help since the docs specify

    "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"

    so, it uses wmi or rpc... you can try this

    gwmi win32_process -computername $name

    im guessing that will give the same error, but might provide more details... its likely a firewall or security issue.

    Justin Rich
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, August 22, 2011 6:09 PM
  • Get_WMIObject wim32_process -computername thecomputername returns a VERY detailed (and long) listing of processes and details, so it definitley seems to connect.

    Firewall on both is disabled, and they are on a LAN.  Both are VMs, running on different hosts, but within same LAN.  The account I am running with is Domain Admin, also considered the elevated security for UAC, but the other machines which work fine have UAC enabled and do not have any issues with this.

    Also, not sure if it matters much, but I did try from two other servers to rule out my original server being the problem.  Both of those other servers experience same issue when trying to run get-process to that computer.

    Monday, August 22, 2011 6:36 PM
  • so, I guess get-process is using a different method of remoting than the get-wmiobject

    I will say the gwmi win32_process has all the same info... you make it look more like get-process if you want with a select-object or format-table

    gwmi win32_process -computer $name | ft caption,handle

    toss on whatever properties you want to see...

    Justin Rich
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, August 22, 2011 6:49 PM