# WINRM Through a proxy server

**URL:** <https://forums.powershell.org/t/winrm-through-a-proxy-server/14025>\
**Category:** PowerShell Help\
**Created:** [March 24, 2020, 2:51pm UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025 "2020-03-24T14:51:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fishandchips](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@fishandchips](https://forums.powershell.org/u/fishandchips)\
**Post date:** [March 24, 2020, 2:51pm UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025/1 "2020-03-24T14:51:59Z")

</div>

Hello All,

When I attempt the following command

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

I get the following error which baffles me

&nbsp;

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 ?

&nbsp;

Many thanks

---

<div class="post-metadata">

**Author:** ![ralphmwr](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/ralphmwr/32/1064_2.png) [@ralphmwr](https://forums.powershell.org/u/ralphmwr)\
**Post date:** [March 24, 2020, 3:46pm UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025/2 "2020-03-24T15:46:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![fishandchips](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@fishandchips](https://forums.powershell.org/u/fishandchips)\
**Post date:** [March 25, 2020, 1:00am UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025/3 "2020-03-25T01:00:20Z")

</div>

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 ?

&nbsp;

Thanks

---

<div class="post-metadata">

**Author:** ![ralphmwr](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/ralphmwr/32/1064_2.png) [@ralphmwr](https://forums.powershell.org/u/ralphmwr)\
**Post date:** [March 25, 2020, 7:47am UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025/4 "2020-03-25T07:47:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fishandchips](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@fishandchips](https://forums.powershell.org/u/fishandchips)\
**Post date:** [March 25, 2020, 11:22am UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025/5 "2020-03-25T11:22:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:30pm UTC](https://forums.powershell.org/t/winrm-through-a-proxy-server/14025/6 "2024-05-16T20:30:01Z")

</div>

Closed on May 16, 2024, 8:30pm UTC


