# Script to change proxy settings



## sprite1

Hi all, 

I'm in need of an example script that i can change accordingly to my working environment. 

I'm currently working at four different locations and move my laptop around with me all of the time. The problem is that in each of my locations i require a different proxy address and port or when at home, none. I'm now fed up with opening up internet explorer and changing the settings manually each time i move location. 

Whether this is possible or not i am unsure but what i would like to achieve is four icons on my desktop each called the working location ie home.vbs workplaceone.vbs and so on. I would then be able to double click on these and that would invoke a change to my proxy settings inside IE. 

So for each of my work places i would need the following two boxes checked, 

'Use a proxy server for your LAN (these settings will not apply to dial-up or VPN Connections)' 
'Bypass proxy server for local addresses' 


I Would then need to enter my proxy address and port number. 

The home settings would need to remove both of the above boxes. 

Does anyone have any example scripts i could manipulate accordingly? 

Thanking in advanced, 

Regards, 

Sprite


----------



## Squashman

Not on my computer right now but I would check out NetSetMan. I think it does proxy settings as well. I can't remember.


----------



## Phantom010

This can be done by working with the following registry key:

*HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings*

and the following values:

*ProxyEnable* (select 1 to enable proxy server, select 0 to disable)

*ProxyServer*

*ProxyOverride* (Bypass proxy server for local addresses)

First, create a .reg file with Notepad.



Code:


Windows Registry Editor Version 5.00
 
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001
"ProxyServer"="http://Proxy server:port"
"ProxyOverride"="<local>"

Save that as something like *ProxyEnable.reg *to C drive.

Next, create a batch file with Notepad:



Code:


regedit.exe /s "C:\ProxyEnable.reg"

Save it as *ProxyEnable.bat*, to C drive.

Now, you need to do the same to disable the proxy server:



Code:


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

Save it as *ProxyDisable.reg*, to C drive.

Create the following batch file with Notepad:



Code:


regedit.exe /s "C:\ProxyDisable.reg"

Save it as *ProxyDisable.bat*, to C drive.

You can create shortcuts to the batch files on your desktop.

This is one way of doing it without messing with complicated scripts.


----------



## sprite1

Phantom010 thanks so much for your help, i now have four icons that work just as i wish. I did take a look at the reg option however didnt like the yes/no message when running the reg file. wasnt aware of the silent switch.

Again thanks a lot. Thanks also to the other response in this post.


----------



## Phantom010

You're welcome!


----------



## Squashman

The free version of NetSetMan does not change proxy settings but the Pro version does. But looks you have a solution.


----------



## Squashman

Or you could use this. Runs in the system tray.
http://www.proxychanger.com/


----------

