There are two ways to write error-free programs; only the third one works.

Setting Proxy settings in IE using PowerShell

Whenever I go to a client and need to plugin to their network, I would find myself typing in proxy settings to get internet access. In IE, that would be in Tools -> Internet Options -> Connections -> LAN Settings. When I'm back in the office and plugged in to my corporate network, these settings get overridden to valid values in my corp network. Given that I regularly visit my client, you can see how I have to do this dance every now and then.

So out with my PowerShell toolbox to hammer together my "set-proxysettings.ps1" script.

First, I had to find where IE stores these settings in the registry. I used regmon for that.

Once I had the registry settings, the rest was easy.

cd HKCU:\"Software\Microsoft\Windows\CurrentVersion\Internet Settings"

set-itemproperty . ProxyEnable 1
set-itemproperty . ProxyServer <proxy server:port>
set-itemproperty . ProxyOverride "<local>"

new-itemproperty . AutoConfigURL
set-itemproperty . AutoConfigURL <autoconfig url>

So whenever I'm at my client's site, I just run my powershell script to set my proxy settings.

For an excellent resource on learning PowerShell see Mastering PowerShell in your Lunch Break

Posted: 06-23-2007 12:34 PM by velocity | with no comments
Filed under: