I am currently in Powershell V5.1 and would like to bypass Internet Explorer proxy on a Invoke-RestMethod command.
In Powershell V6, there is the -NoProxy option that indicates that the cmdlet will not use a proxy to reach the destination. This is to bypass the proxy configured in Internet Explorer and this is exactly what I want to do.
In Powershell V6, the code would be something like:
$Result = Invoke-RestMethod -Uri $url -NoProxy
Any workaround in V5.1 ?
Thanks, Philippe
Not natively, as these were some of the improvements, in PSCore web cmdlets and MS has stated that nothing will be backported. You can just shell out to PSCore from PS5x to use the cmdlet as is.
Something like this has be done for Invoke-WebRequest using this function:
Update-Proxy.ps1
As per this Q&A
Invoke-WebRequest Proxy Bypass
So, it might work with Invoke-RestMethod, but I not in a location to test this.