+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
Scripts Thread, Proxy Changer Script in Coding and Web Development; I've had a look for some sort of program or other script to change proxy settings in IE but can't ...
  1. #1

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414

    Proxy Changer Script

    I've had a look for some sort of program or other script to change proxy settings in IE but can't find anything to do exactly what I want.

    So far I've got:

    Option Explicit
    Dim objShell
    Dim strProxyenable, strProxy

    strProxyenable = "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyEnable"
    strProxy = "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyServer"

    Set objShell = CreateObject("WScript.Shell")

    strProxyenable = objShell.RegRead(strPRoxyenable)

    If strProxyenable = 1 then
    'Turn it off
    objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyEnable","0","REG_DWORD"
    objShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyServer"
    objshell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyOverride"
    Wscript.Echo "Proxy Disabled"
    WScript.Quit
    else
    'Turn it on
    objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyEnable","1","REG_DWORD"
    objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyServer","address_here:1080","REG_SZ"
    objshell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyOverride","*.wayland.local;10.104.64 .*;10.104.65.*;server03;wserver01","REG_SZ"
    Wscript.Echo "Proxy Enabled"
    wscript.quit
    end if


    Which works but it doesn't check the box labelled "Bypass proxy server for local addresses"

    Ben

  2. Thanks to plexer from:

    bizzel (13th March 2008)

  3. #2

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    grr hehe fixed it myself just after posting.

    You need to add <local> to the list of local addresses and it then enables the check box.

    So that line becomes:

    objshell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings\ProxyOverride","<local>*.wayland.local;10 .104.64.*;10.104.65.*;server03;wserver01","REG_SZ"

  4. #3

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    AutoIT:

    Code:
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "First Home Page", "REG_SZ", "http://moodle.st-johns.org.uk/")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page", "REG_SZ", "http://moodle.st-johns.org.uk/")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ", "10.0.0.2:8080")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "Proxyenable", "REG_DWORD", "1")
    RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyOverride", "REG_SZ", "intranet")
    Run('C:\Program Files\Internet Explorer\iexplore.exe')

  5. #4
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    42
    Ok i admit i havent looked at the script yet so i dont fully know what you are doing but can't you just do all this through gpo...

  6. #5

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    No because the point is that teachers want to use their laptops at home thus I need to be able to turn the proxy settings on and off.

    This script turns the setting off if it's on and on if it's off, so they just need to double click it at home to turn it off then double click when they come back to school to turn it on.

    I can't rely on gpo settings reapplying at school.

    Ben

  7. #6

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Quote Originally Posted by plexer View Post
    No because the point is that teachers want to use their laptops at home thus I need to be able to turn the proxy settings on and off.

    This script turns the setting off if it's on and on if it's off, so they just need to double click it at home to turn it off then double click when they come back to school to turn it on.

    I can't rely on gpo settings reapplying at school.

    Ben
    That should be straight forward in AutoIT - just create a GUI with two buttons on......
    I think you already have it sorted though.....

  8. #7

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    The script works and thinks it's changed the settings shame it doesn't work on a users laptop

    Ben

  9. #8
    robk's Avatar
    Join Date
    Nov 2005
    Location
    Ashbourne
    Posts
    682
    Thank Post
    172
    Thanked 128 Times in 107 Posts
    Blog Entries
    1
    Rep Power
    47
    Quote Originally Posted by plexer View Post
    No because the point is that teachers want to use their laptops at home thus I need to be able to turn the proxy settings on and off.

    Ben
    Just a thought, but if you configure wpad on the school network, you can then just tick auto, and the proxy magically changes from home to school.

    It needs a webserver on the school network and a javascript file with the settings it.

    This assumes one proxy per school though.

    RobK

  10. #9
    mark's Avatar
    Join Date
    Jun 2005
    Posts
    3,958
    Thank Post
    248
    Thanked 49 Times in 45 Posts
    Blog Entries
    2
    Rep Power
    46
    I did the same recently, thought the script seems to be a bit slow.

    What about FF?

  11. #10

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Quote Originally Posted by mark View Post
    I did the same recently, thought the script seems to be a bit slow.

    What about FF?
    You should be able to edit the prefs.js in the users profile for that - [ I use a basic launch script which copies over some default profile settings before ff launches for our users ]

  12. Thanks to mattx from:

    mark (12th March 2008)

  13. #11

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    FF is no good they have to use ie at school and home because our web based mis only works properly with ie.

    Ben

  14. #12

    SYSMAN_MK's Avatar
    Join Date
    Sep 2005
    Posts
    4,005
    Thank Post
    489
    Thanked 1,340 Times in 728 Posts
    Rep Power
    427
    How about this vbs script? I use it to add/remove the tick box from IEs use proxy server setting.

    Code:
    Const HKEY_CURRENT_USER = &H80000001
    
    intmsg = msgbox("CHANGE PROXY SETTINGS" & chr(13) & "ARE YOU AT HOME?",vbYesNo+vbQuestion,"WHERE ARE YOU?")
    
    if intmsg = vbyes then dwvalue = 0 else dwvalue = 1
    
    strComputer = "."
    Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
     
    strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings"
    
    strValueName = "ProxyEnable"
    objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue
    
    msgtxt = "THE PROXY SERVER HAS BEEN "
    if dwvalue = 0 then msgtxt = msgtxt & "DISABLED"
    if dwvalue = 1 then msgtxt = msgtxt & "ENABLED"
    
    intmsg = msgbox(msgtxt,vbOKOnly+vbInfo,"Done")
    I have also got another version somewhere which adds changing the startup page and adds/remove the proxy address also. I'll see if I can dig it out.

  15. Thanks to SYSMAN_MK from:

    FN-GM (28th April 2008)

  16. #13

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    The script I've put together changes the correct registry keys for the user however even though I've set everything possible in my gpos to make the proxy settings per user the browser still appears to be using the machine specific proxy settings.

    Ben

  17. #14

    Join Date
    Jun 2007
    Location
    Rainhill High School
    Posts
    38
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0
    why dont you just export the settings from regedt32 with proxy on and proxy off(search the registry for the exact part) and save to desktop will allow them to turn proxy on and off easily

  18. #15

    plexer's Avatar
    Join Date
    Dec 2005
    Location
    Norfolk
    Posts
    13,344
    Thank Post
    624
    Thanked 1,584 Times in 1,421 Posts
    Rep Power
    414
    ffs because that won't work either, the script I've written works fine and it changes those registry values fine.

    However it appears that even though I've changed everything I can find in the gpo's to set per use proxy settings that the pc's are using per machine settings.

    I run the script once to disable the proxy settings and using regedit the values get changed correctly but IE still shows proxy settings that exist in the local_machine registry.

    Ben

SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Set firefox proxy via login script
    By Jackd in forum Windows
    Replies: 2
    Last Post: 24th December 2009, 01:59 PM
  2. Proxy Authentication Script - HELP!!!!!
    By chrisa in forum Scripts
    Replies: 9
    Last Post: 7th March 2008, 04:34 PM
  3. Proxy switch "proxy on" & " proxy off" software
    By GavRob in forum Network and Classroom Management
    Replies: 20
    Last Post: 30th July 2007, 10:05 PM
  4. proxy server script
    By chrbb in forum How do you do....it?
    Replies: 2
    Last Post: 7th March 2007, 10:57 PM
  5. Interesting proxy script
    By GrumbleDook in forum Scripts
    Replies: 8
    Last Post: 9th December 2005, 01:06 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •