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:
1 |
notepad $PROFILE |
Or open “Microsoft.PowerShell_profile.ps1” and “Microsoft.PowerShellISE_profile.ps1” in Explorer with notepad:
1 |
C:\Users\%Username%\My Documents\WindowsPowerShell |
Once open, paste in the following, editing the proxy address and port.
1 2 3 4 5 |
[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
1 |
update-help |
Leave a Reply