Changing proxy settings on IE

Author
Discussion

DaveL485

Original Poster:

2,758 posts

198 months

Tuesday 20th October 2009
quotequote all
Can you automate turning the proxy server settings on and off in IE?

I wrote a registry entry (shown below) but it doesn't work... (ip's edited)

REGEDIT
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyServer"="111.111.11.11:8080"
"ProxyEnable"=dword:00000001
"ProxyOverride"="123.456.1.1"

Allanv

3,540 posts

187 months

Tuesday 20th October 2009
quotequote all
single computer or a domain wide change?

Slinky

15,704 posts

250 months

Tuesday 20th October 2009
quotequote all
I've got a script that I use in the office... drop me an email and I'll help you out..

DaveL485

Original Poster:

2,758 posts

198 months

Tuesday 20th October 2009
quotequote all
Thanks for the replies, a bit of googling revealed this tidy little html...

Paste into notepad and save as proxychanger.htm smile

html code said:
<html>
<head>
<title>ProxySwitcher by CrazyMatt</title>
</head>
<HTA:APPLICATION
SysMenu="no"
ID="objAutoRefresh"
SCROLL="no"
SINGLEINSTANCE="yes"
>
<SCRIPT LANGUAGE="VBScript">
Sub Window_OnLoad
const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
strTEXT = dwValue
If strTEXT < 1 Then
DataArea.InnerHTML = "IE Proxy is OFF"
Else
DataArea.InnerHTML = "IE Proxy is ON"
end If
End Sub

Sub Proxy
const HKEY_CURRENT_USER = &H80000001
strComputer = "." 'sets local computer
Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
oReg.GetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,dwValue
strTEXT = dwValue
If strTEXT < 1 Then
strValue = 1
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue
'This turns the proxy on by setting the reg dwvalue to 1
Else
strValue = 0
'This turns the proxy off by setting the reg dwvalue to 0
oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,strValue
end If
location.reload( True )
end Sub

Sub ExitProgram
window.close()
End Sub

Sub bodyLoaded()
window.ResizeTo 176,140 ' WIDTH, HEIGHT
End Sub
</script>
<body onLoad="bodyLoaded()" STYLE="font:12 pt arial; color:white;
filtertongue outrogid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')">
<P align=center>
<span id = "DataArea"></span><BR>
<input id=runbutton type="button" value="Proxy On/OFF" onClick="Proxy"><BR><BR>
<input id=runbutton type="button" value="Exit" onClick="ExitProgram">
</P>
</body>
</html>