Question Locked

Turn proxy settings on and off script.

0 helpful
10 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi guys and gals!

Anybody out there feeling generous enough to knock up a simple script that effectively just ticks / unticks the "Use a proxy server..." in the LAN settings window under the IE connections tab?

I've searched using Google, and there are some out there, but they seem to have errors / bugs and not being much of a script kiddie, I can't do it myself! :(

10 replies

by blackepyon01

Is the script meant to be a simple toggle every time it's executed or is do you need a trigger?

I personally use a script on my laptop that when executed, detects which network I'm on by serching for a server, then sets network shares, installs printers, sets proxy, etc. based on which network I'm on.

I might be able to help.

by bizintelligence

Is that your work PC/Laptop?

If it is work PC/Laptop then proxy might be getting turned on with login script or domain group policy.
You can avoid that (in case if it is work pc) if you create a local user (need administrative rights) and then login. In that case domain policy or login script won't apply. Proxy will not be turned on.

If it is Home PC then I am wondering why do you need proxy? Do you have proxy server?

Cheers !

by blackepyon01

Mine is my own private laptop that I use at work. I do system administration for a private school community. The school has a full doamin and a proxy internet filter. My laptop isn't joined to domain, that's why I have my script so complex.

by blackepyon01

What I used before I started playing around with VBS was two .reg files that I shortcut'ed to the desktop. "proxy.reg" and "noproxy.reg"

"proxy.reg" substitute "ProxyServer" data with your (proxy IP address):(port #)
---------
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
"ProxyEnable"=dword:00000001
"ProxyServer"="192.168.10.10:3128"
"ProxyOverride"="192.168.*;"

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

just copy the relavent text into text files and rename with the .reg extention.
Click on the one you want to apply, it may ask if you want to apply it to regisry, click yes.

If you'd like, I could whip up a single vbs script that would toggle on/off when you execute it. Let me know.

by blackepyon01

Copy the following text to file and name as *.vbs. I hold no copyright for this, so share and modify as you like.

Option Explicit
Dim WSHShell, strSetting
Set WSHShell = WScript.CreateObject("WScript.Shell")

'Determine current proxy setting and toggle to oppisite setting
strSetting = wshshell.regread("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable")
If strSetting = 1 Then
NoProxy
Else Proxy
End If

'Subroutine to Toggle Proxy Setting to ON
Sub Proxy
WSHShell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"
End Sub

'Subroutine to Toggle Proxy Setting to OFF
Sub NoProxy
WSHShell.regwrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 0, "REG_DWORD"
End Sub

by tobif

Original question was posted more than two years ago.

by robo_dev

You get a pretty green button that toggles the proxy setting on/off.

This discussion is closed to new replies.