Toggle Windows Proxy Settings
December 19th, 2008If you use a laptop both at home and at work it gets really annoying having to switch between using and not using a proxy server to connect to the internet.
Having found quite a few sites explaining how to get the ProxyEnable registry value it’s pretty trivial to make a VBScript that toggles the flag on and off. Just save this script in a file with a .vbs extension and double click to run. Each time it runs it will just toggle the proxy on and off .
I could write the usual warning about modifying the registry but we’re all adults here….
Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
objRegistry.GetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
if dwValue=0 then
dwValue=1
else
dwValue=0
end if
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
if dwValue=1 then
msg="Proxy Enabled"
else
msg="Proxy Disabled"
end if
msgbox msg,64,"Proxy Toggle"