<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>sharpreflections.net &#187; Scriptings</title>
	<atom:link href="http://blog.sharpreflections.net/category/scriptings/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sharpreflections.net</link>
	<description>Thoughts about .Net, programming and other more important stuffs.</description>
	<lastBuildDate>Fri, 20 Nov 2009 00:24:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Script Sharp 1 &#8211; Scripting Internet Explorer proxy configuration</title>
		<link>http://blog.sharpreflections.net/2007/03/12/scripting-ie-proxy-configuration/</link>
		<comments>http://blog.sharpreflections.net/2007/03/12/scripting-ie-proxy-configuration/#comments</comments>
		<pubDate>Mon, 12 Mar 2007 21:48:13 +0000</pubDate>
		<dc:creator>matteosp</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Scriptings]]></category>

		<guid isPermaLink="false">http://sharpreflections.wordpress.com/2007/03/12/script-sharp-1-scripting-ie-proxy-configuration/</guid>
		<description><![CDATA[This is for those who continuously have to configure Internet Explorer proxy settings to match different network locations.
I have two different configurations I&#8217;m switching at least twice a day: one for when I&#8217;m in the office and another for my home WI-FI network. Not to talk about the number of configurations I have for the [...]]]></description>
			<content:encoded><![CDATA[<p>This is for those who continuously have to configure Internet Explorer proxy settings to match different network locations.</p>
<p>I have two different configurations I&#8217;m switching at least twice a day: one for when I&#8217;m in the office and another for my home WI-FI network. Not to talk about the number of configurations I have for the customers I sometimes have to visit.</p>
<p>Script must be included in a .vbs file that you can call directly from the shell or with a shortcut.</p>
<p>Here the code you can run to enable/disable proxy:</p>
<pre><span style="color:#0000ff;">On</span> <span style="color:#0000ff;">Error</span> Resume <span style="color:#0000ff;">Next</span>

<span style="color:#0000ff;">Const</span> HKEY_CURRENT_USER = &amp;H80000001

strComputer = "<span style="color:#8b0000;">.</span>"
strKeyPath = "<span style="color:#8b0000;">SoftwareMicrosoftWindowsCurrentVersionInternet Settings\"</span>

<span style="color:#0000ff;">Set</span> objReg = <span style="color:#0000ff;">GetObject</span>("<span style="color:#8b0000;">winmgmts:{impersonationLevel=impersonate}</span>" &amp; strComputer &amp; "<span style="color:#8b0000;">rootdefault:StdRegProv</span>")
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, "<span style="color:#8b0000;">ProxyEnable</span>", 1 <font color="#008000">'Use 0 to disable proxy</font>
objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, "<span style="color:#8b0000;">ProxyServer</span>", "<font color="#800000">proxyName<span style="color:#8b0000;">:8080</span></font>"

<span style="color:#0000ff;">If</span> <span style="color:#0000ff;">err</span>.Number &lt;&gt; 0 <span style="color:#0000ff;">Then</span>
    <span style="color:#0000ff;">MsgBox</span> <span style="color:#0000ff;">err</span>.Description
<span style="color:#0000ff;">End</span> <span style="color:#0000ff;">If</span>

<span style="color:#0000ff;">MsgBox</span> "<span style="color:#8b0000;">Done!</span>"</pre>
<p>Note that you can work on a different machines (strComputer) and impersonate a desired user (the WMI string passed to GetObejct() function), but I haven&#8217;t investigated this yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharpreflections.net/2007/03/12/scripting-ie-proxy-configuration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
