Enable/Disable /Change IE Proxy by script/programmatically

Ok. You know the drill, you need to use the company’s proxy server at work and at home you don’t need a proxy server.(or you use another one)

Well, do you really want to open up IE and go into Tools->Internet Options->Connections->LAN Settings->Proxy Server to change the address or disable/enable it?

(You can actually open Internet Options from Control Panel without opening up IE, but anyway, it still is a long process.)

As everything useful is done in Registry in Windows, we again have some registry scripts.

To disable proxy:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000000

To enable proxy:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001

To change proxy:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"MigrateProxy"=dword:00000001
"ProxyEnable"=dword:00000001
"ProxyHttp1.1"=dword:00000000
"ProxyServer"="http://ProxyServername:80"
"ProxyOverride"="<local>"

Copy these to a .reg file and double click on them to do the trick.  The good part of doing it this way is that it works on every IE version(well, I haven’t tried any IE lower than IE6 :) and it is able to change it without even opening up anything.

You can actually do more by making a VBS script or whatever to get the current local ip address and check if it is an address in your home network or work network, and do the necessary action automatically.

Post a Comment