Using PowerShell Behind a Proxy Server

If your computer is on a corporate network behind a proxy server, by default you won’t be able to access external web resources from your PowerShell CLI. For example, you won’t be able to get the content of an external web page using the Invoke-WebRequest cmdlet, update help using the Update-Help, connect to Azure/Microsoft 365 tenant (Exchange Online PowerShell module), install modules from PSGallery, or RSAT capabilities, download an application package or System Drivers from an external software repository ( external FTP share). This is very annoying but don't worry, I am happy to offer the solution for you!!!


PowerShell Script

By default, the PowerShell Script Execution Policy doesn’t allow PS scripts to run, even from PowerShell profile files. To allow PS1 scripts to run, you need to change your PowerShell Execution Policy settings.


Download the script file and add it to your actual script which requires access to external data through a proxy server.


Proxy_Auto-Config
.zip
Download ZIP • 2KB

 

Please ensure you perform adequate testing before using the script in your environment.



* Please feel free to reach out with any comments or questions!

LinkedIn

Twitter