How to make a program/script that will change the proxy settings

Status
Not open for further replies.
Joined
Dec 16, 2011
Messages
1,995
Reaction score
633
Hello!

I was in need of a script I can base from, I basically wanted the script to be able to change the proxy settings on a computer, for example, you can change your proxy settings VIA Internet Explorer, example:


I want to be able to have a script that will automatically allow the user to open the script, and run it and it will chance the settings to the ones provided by me!

Example, I would want the proxy settings to be this:


The reason why, is because some people at my work use proxys and it chances all the proxy settings so to make life easier, I wanted to give this script to everyone so they could easily chance it in a click!
 
Praise the Sun!
Loyal Member
Joined
Dec 4, 2007
Messages
2,502
Reaction score
986
VBS would be your best bet. Here you go:

PHP:
' *  VBScript to change the IE Proxy Server, by directly editing the registry
 ' *  Enjoy!
   
   Option Explicit
   
   ' *  Proxy Server
   
   Dim proxy
   proxy = "172.16.0.1:3128" 'For example at my work it's like that so here you can make some change :)
   
   ' *  Application Title
   
   Dim Title
   Title = "Proxy Changer"
   
   ' *  Welcome Message
   
   Dim Welcome_Text
   Welcome_Text = "Do you really want to change the Proxy Server to " & proxy & "?"
   
   Call Welcome()
   
   Sub Welcome()
       Dim GO
       GO = MsgBox(Welcome_Text, 36, Title)
       If GO = 7 Then
           WScript.Quit
       End If
   End Sub
   
   ' *  Warning Message
   
   Dim Warning_Text
   Warning_Text = "Warning:  All current Internet Explorer and Windows Explorer windows will be closed." & Chr(10) _
                   & Chr(10) _
                   & "Do you still wish to continue?"
   
   Call Warning()
   
   Sub Warning()
       Dim GO
       GO = MsgBox(Warning_Text, 36, Title)
       If GO = 7 Then
           WScript.Quit
       End If
   End Sub
   
   ' *  WSHShell
   
   Dim WSHShell
   Set WSHShell = WScript.CreateObject("WScript.Shell")
   
   ' *  Kill IE (and consequently WE as well)
   
   Call Kill_IE()
   
   Sub Kill_IE()
       While WSHShell.AppActivate("Internet Explorer")
           WSHShell.SendKeys "%{F4}"
           WScript.Sleep 500    ' Impedes a traffic jam
       WEnd
   End Sub
   
   ' *  Regedits
   
   WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", 1, "REG_DWORD"
   WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", proxy
   WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride", ""
   WSHShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\DisablePasswordCaching", 1, "REG_DWORD"
   
   ' *  Confirmation
   
   Dim confirm
   confirm = MsgBox("Proxy Server has been changed to " & proxy & ".  Enjoy.", 64, Title)
   
   ' *  Open IE
   
   WSHShell.run "iexplore.exe http://www.google.com"

Credits:
 
Status
Not open for further replies.
Back
Top