3

I can get and set proxy settings for a WebClient object and make outbound calls.

I can also supply -Proxy and -ProxyCredential to individual CmdLets, but how can I just set a global default so CmdLets don't need the extra arguments?

Thanks

Luke

Luke Puplett
  • 939
  • 3
  • 16
  • 24

1 Answers1

2

From https://joshcodev.wordpress.com/2014/02/07/powershell-set-a-proxy/,

$global:PSDefaultParameterValues = @{ 'Invoke-RestMethod:Proxy'='http://proxyServer:proxyPort' 'Invoke-WebRequest:Proxy'='http://proxyServer:proxyPort' '*:ProxyUseDefaultCredentials'=$true }

Adam Baxter
  • 238
  • 2
  • 9
  • Use this. Is supported custom proxy in powershell: https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey – Felix Aballi Oct 29 '16 at 17:00
  • Thanks, but the question is about Powershell in general, not Chocolatey. Also, those IE settings can't be set in all environments (i.e. locked down enterprise) – Adam Baxter Oct 29 '16 at 21:35