At work I’m behind a proxy which caused me havock when trying to install modules into PowerShell.
That was until I found this amazing script to tell PowerShell to use a proxy.
First open your PowerShell profile by either doing this in PowerShell:
Or open “Microsoft.PowerShell_profile.ps1” and “Microsoft.PowerShellISE_profile.ps1” in Explorer with notepad:
Once open, paste in the following, editing the proxy address and port.
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy('http://ProxyName:ProxyPort') [system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials [system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
This will use your current credentials you’re logged in with to pass the commands to the proxy server.
Test with a