Switching the Internet Proxy on/off

I had the problem, that I need to use a proxy at work and no proxy at home. The only thing I did, was to switch the proxy on in the morning and off in the evening, you get used to it, but it is not nice. I found some scripts on the Internet, but what was not working, is that after enabling or disabling the proxy by script, it seems that the open browser was not notified about the change of the proxy setting. I had to close and reopen the browser after each change.

When I searched on the Internet, I found some people, that had the same problem, but normally without an answer how to solve it. The only answer I found was here on StackOverflow. This lead to a powershell script on GitHub , that has a function that uses WinINet and InternetSetOption() to set the options “INTERNET_OPTION_SETTINGS_CHANGED” and “INTERNET_OPTION_REFRESH”.

This did not solve my issue directly, but I set me on the correct trail, I found another option “INTERNET_OPTION_PROXY_SETTINGS_CHANGED” that did the trick for me.

The result is a powershell script that you can find here on GitHub

Leave a Reply

Your email address will not be published. Required fields are marked *