WINRM Through a proxy server

Hello All,

When I attempt the following command

Invoke-Command -ComputerName XXXXX -ScriptBlock {get-process}

I get the following error which baffles me


S C:\Windows\system32> Invoke-Command -ComputerName XXXXX -ScriptBlock {get-process}
[XXXXX ] Connecting to remote server XXXXX failed with the following error
message : WinRM cannot complete the operation. Verify that the specified computer name is valid,
that the computer is accessible over the network, and that a firewall exception for the WinRM
service is enabled and allows access from this computer. By default, the WinRM firewall exception
for public profiles limits access to remote computers within the same local subnet. For more
information, see the about_Remote_Troubleshooting Help topic.

  • CategoryInfo : OpenError: (XXXXX :String) [], PSRemotingTransportException
  • FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionStateBroken

I have checked the following

  1. PS-Remoting is enabled on both sides
  2. Windows Firewall is disabled on both local and remote machine
Now from my research since WINRM uses HTTP/HTTPS. One article talks about using a specificy proxy to go through to access the remote machine. Essentially does this mean I need to import the proxy IP address into the session ? then attempt to launch the invoke-command again ?


Many thanks

Is the remote machine on a domain? Are you using an ip address or hostname? Have you tried to ping the ip or hostname (whichever you are using) from the source machine?

Yes the remote machine is on a domain and I can ping both the hostname and IP address without issues. I cannot get my head around it something to do with WINRM using http/https and it needs a reconfig of the proxy settings. Do you have any thoughts ?



Unless both machines are on the same domain and you are launching PowerShell on the source machine using domain credentials (account in the administrators group), I think you need to include the Credentials parameter in your Invoke-Command call. Have you tried DCOM / RPC?

Get-Process -ComputerName <remote machine>

If this works it is likely not a network issue (unless firewall is blocking 5985, 5986), but probably a WinRM issue and restarting that service (on the remote machine) or the machine itself has worked for me in the past.

Hi Mike I tried restarting the winrm service on both the local and the remote machine the problem still persists. I have confirmed that the firewall is not blocking either ports. Its strange issue