Follow via:
RSS
Email Alert
Question
0 Votes
+ -

Turn proxy settings on and off script.

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! sad
Updated - 31st Jul 2008

Answers (5)

0 Votes
+ -
trigger?
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.
Updated - 16th Jun 2009

Replies

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 !
BizIntelligence 16th Jun 2009
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.
blackepyon01@... 17th Jun 2009
0 Votes
+ -
Something to get you started....
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.
Updated - 17th Jun 2009
1 Vote
+ -
Made you a script!
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
18th Jun 2009
0 Votes
+ -
proxy pal
get it- use it
10th Aug 2010

Replies

Original question was posted more than two years ago.
TobiF 22nd Oct 2010
You get a pretty green button that toggles the proxy setting on/off.
robo_dev 22nd Oct 2010
0 Votes
+ -
blackepyon01
great script man
11th Sep 2011
Answer the question
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.