Wednesday, January 12, 2011

How to switch proxy settings via script?

There are a number of users in our organization that use their laptops on multiple networks. Each network has its own proxy setting requirements for accessing the Internet and currently, the users must manually change these settings in Internet Settings whenever moving to a different network.

Is it possible to script the changes so that the user can just run the appropriate script for the network they're on?

This is primarily for Windows XP but might also be required for Vista and Windows 7.

  • Microsoft kb 819961 is a good starting point.

    The registry settings for the browser are located here.

    [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings]
    "MigrateProxy"=dword:00000001
    "ProxyEnable"=dword:00000001
    "ProxyHttp1.1"=dword:00000000
    "ProxyServer"="http://ProxyServername:80"
    "ProxyOverride"="<local>"
    

    It should be pretty easy to build a vbs or powershell script to automatically update the registry.

    Jeff Yates : Ah, I didn't even think about the registry - no idea why. Thanks!
    From Zoredache
  • Look into proxy auto-config scripts. You can script changes to the Windows registry to select a different proxy server, but you'll really like proxy auto-config scripts and how they work on your client computers.

    http://en.wikipedia.org/wiki/Proxy_auto-config

    I moved to proxy auto-config files for my school district Customer a couple of years ago as a result of administrators taking laptops off-site and trying to work on other networks that didn't need an HTTP proxy specified. It's worked like a charm, and is a nice cross-browser and cross-platform compatible solution.

    Jeff Yates : This sounds ideal - I'll look into it.
    : I will drop in and second this solution, - it really _is_ as ideal as it gets, no more registry hacking, no more manual changes. It just works.
    Jeff Yates : This worked great, by the way, once I got it set up.
    Evan Anderson : Boo-yeah! Proxy autoconfiguration is "the bomb".
  • There are a couple different ways to do this, but I would personally looking at applying a GPO that would run a logon script. This script would look at the subnet the user was in, and apply the appropriate proxy setting. This website describes the place in the registry where the change would have to be made.

    http://www.computing.net/answers/networking/changing-ie-proxy-via-login-script/22498.html

    From bread555

0 comments:

Post a Comment