Wednesday, January 15, 2020

Automate IE Proxy Setting Changes on Network Adapter Changes–Windows Powershell

If you need to turn on IE Proxy settings, say if the LAN cable is plugged in and reverse the setting, once Wireless got connected, you could rely on Powershell script to automate the same in Windows environment.

This is a two step process:

1. Create the powershell script, which detects the Network Adapter Change, and update IE Settings accordingly

Sample Script here:

2. Create a new Task in “Task Scheduler”, which will be triggered on Network Changes (NetworkProfile->Event ID:10000) and System Startup

Set the above script as the Action, for the task

Eg

Program: powershell.exe

Arguments: -windowstyle hidden "<PathTo>\SwitchProxyOnNetworkChange.ps1":

Note: This will run the script in hidden mode, so that user won’t notice the powershell window – for the best experience


From now on whenever your Network get changed, the script will be triggered automatically to set IE Proxy settings accordingly.