PC Review


Reply
Thread Tools Rating: Thread Rating: 4 votes, 2.00 average.

vbscript to change IE Proxy

 
 
William Hymen
Guest
Posts: n/a
 
      8th Aug 2005
I am looking for a hard coded vbscript to plug in
the company proxy and exclusion list:
Connections -> LAN settings -> Proxy Server [advanced] [exceptions];
And another script to "uncheck" all that and enable "Automatically detect
settings"

We are having problems supporting home
users who want to connect to the company
intranet using a VPN client; then later
disconnect and surf the web using their own ISP.
(the ISP would use either NO proxy or automatically detect settings.

They all have cable modems and routers using DHCP.
But we don't support anything beyond the laptop;
that's up to the home user. ( we don't have enough staff to support
routers that they buy)

Nothing seems to work except changing the proxy.

Thanks to much in advance.

Bill


 
Reply With Quote
 
 
 
 
=?Utf-8?B?SiBGb3Jk?=
Guest
Posts: n/a
 
      8th Aug 2005

Basically just right a script that r/w to the following registry location

HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
ProxyEnable <- REG_DWORD Val '0' Off, '1' On
ProxyOverride <- REG_SZ Val ';' delimited

Jeremy

"William Hymen" wrote:

> I am looking for a hard coded vbscript to plug in
> the company proxy and exclusion list:
> Connections -> LAN settings -> Proxy Server [advanced] [exceptions];
> And another script to "uncheck" all that and enable "Automatically detect
> settings"
>
> We are having problems supporting home
> users who want to connect to the company
> intranet using a VPN client; then later
> disconnect and surf the web using their own ISP.
> (the ISP would use either NO proxy or automatically detect settings.
>
> They all have cable modems and routers using DHCP.
> But we don't support anything beyond the laptop;
> that's up to the home user. ( we don't have enough staff to support
> routers that they buy)
>
> Nothing seems to work except changing the proxy.
>
> Thanks to much in advance.
>
> Bill
>
>
>

 
Reply With Quote
 
William Hymen
Guest
Posts: n/a
 
      10th Aug 2005
Thanks,

But I'm looking for some vbscript samples
from someone who has coded a working solution.

Thanks anyway!

Bill

"J Ford" <(E-Mail Removed)> wrote in message
news:B7F96ACF-A0E9-40F1-B99C-(E-Mail Removed)...
>
> Basically just right a script that r/w to the following registry location
>
> HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
> ProxyEnable <- REG_DWORD Val '0' Off, '1' On
> ProxyOverride <- REG_SZ Val ';' delimited
>
> Jeremy
>
> "William Hymen" wrote:
>
> > I am looking for a hard coded vbscript to plug in
> > the company proxy and exclusion list:
> > Connections -> LAN settings -> Proxy Server [advanced] [exceptions];
> > And another script to "uncheck" all that and enable "Automatically

detect
> > settings"
> >
> > We are having problems supporting home
> > users who want to connect to the company
> > intranet using a VPN client; then later
> > disconnect and surf the web using their own ISP.
> > (the ISP would use either NO proxy or automatically detect settings.
> >
> > They all have cable modems and routers using DHCP.
> > But we don't support anything beyond the laptop;
> > that's up to the home user. ( we don't have enough staff to support
> > routers that they buy)
> >
> > Nothing seems to work except changing the proxy.
> >
> > Thanks to much in advance.
> >
> > Bill
> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?SiBGb3Jk?=
Guest
Posts: n/a
 
      10th Aug 2005
Here, you click it once it will enable it, you click it again it will disable
it:

<script>
Const HKCU=&H80000001 'HKEY_CURRENT_USER
Const HKLM=&H80000002 'HKEY_LOCAL_MACHINE

Const REG_SZ=1
Const REG_EXPAND_SZ=2
Const REG_BINARY=3
Const REG_DWORD=4
Const REG_MULTI_SZ=7

Const HKCU_IE_PROXY = "Software\Microsoft\Windows\CurrentVersion\Internet
Settings"

Set oReg=GetObject("winmgmts:!root/default:StdRegProv")

Main

Sub Main()

' If Proxy is set then turn it off
If GetValue(HKCU,HKCU_IE_PROXY,"ProxyEnable",REG_DWORD) = 1 AND
Len(GetValue(HKCU,HKCU_IE_PROXY,"ProxyServer",REG_SZ)) > 0 Then
CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",0,REG_DWORD
wscript.echo "Proxy Disabled"
Else
' If Proxy is not set then turn it on

strProxyServer = "MyProxySvr:80"
strProxyOveride = "*.domain.com;*.domain2.com;*domain3.com"

CreateValue HKCU,HKCU_IE_PROXY,"ProxyServer",strProxyServer,REG_SZ
CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",1,REG_DWORD
CreateValue HKCU,HKCU_IE_PROXY,"ProxyOverride",strProxyOveride,REG_SZ
wscript.echo "Proxy Enabled" & vbcrlf & "(" & strProxyServer & ")"
End If

End Sub

Function CreateValue(Key,SubKey,ValueName,Value,KeyType)
Select Case KeyType
Case REG_SZ
CreateValue = oReg.SetStringValue(Key,SubKey,ValueName,Value)
Case REG_EXPAND_SZ
CreateValue =
oReg.SetExpandedStringValue(Key,SubKey,ValueName,Value)
Case REG_BINARY
CreateValue = oReg.SetBinaryValue(Key,SubKey,ValueName,Value)
Case REG_DWORD
CreateValue = oReg.SetDWORDValue(Key,SubKey,ValueName,Value)
Case REG_MULTI_SZ
CreateValue =
oReg.SetMultiStringValue(Key,SubKey,ValueName,Value)
End Select
End Function

Function DeleteValue(Key, SubKey, ValueName)
DeleteValue = oReg.DeleteValue(Key,SubKey,ValueName)
End Function

Function GetValue(Key, SubKey, ValueName, KeyType)

Dim Ret

Select Case KeyType
Case REG_SZ
oReg.GetStringValue Key, SubKey, ValueName, Value
Ret = Value
Case REG_EXPAND_SZ
oReg.GetExpandedStringValue Key, SubKey, ValueName, Value
Ret = Value
Case REG_BINARY
oReg.GetBinaryValue Key, SubKey, ValueName, Value
Ret = Value
Case REG_DWORD
oReg.GetDWORDValue Key, SubKey, ValueName, Value
Ret = Value
Case REG_MULTI_SZ
oReg.GetMultiStringValue Key, SubKey, ValueName, Value
Ret = Value
End Select

GetValue = Ret
End Function
</script>

"William Hymen" wrote:

> Thanks,
>
> But I'm looking for some vbscript samples
> from someone who has coded a working solution.
>
> Thanks anyway!
>
> Bill
>
> "J Ford" <(E-Mail Removed)> wrote in message
> news:B7F96ACF-A0E9-40F1-B99C-(E-Mail Removed)...
> >
> > Basically just right a script that r/w to the following registry location
> >
> > HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
> > ProxyEnable <- REG_DWORD Val '0' Off, '1' On
> > ProxyOverride <- REG_SZ Val ';' delimited
> >
> > Jeremy
> >
> > "William Hymen" wrote:
> >
> > > I am looking for a hard coded vbscript to plug in
> > > the company proxy and exclusion list:
> > > Connections -> LAN settings -> Proxy Server [advanced] [exceptions];
> > > And another script to "uncheck" all that and enable "Automatically

> detect
> > > settings"
> > >
> > > We are having problems supporting home
> > > users who want to connect to the company
> > > intranet using a VPN client; then later
> > > disconnect and surf the web using their own ISP.
> > > (the ISP would use either NO proxy or automatically detect settings.
> > >
> > > They all have cable modems and routers using DHCP.
> > > But we don't support anything beyond the laptop;
> > > that's up to the home user. ( we don't have enough staff to support
> > > routers that they buy)
> > >
> > > Nothing seems to work except changing the proxy.
> > >
> > > Thanks to much in advance.
> > >
> > > Bill
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
William Hymen
Guest
Posts: n/a
 
      15th Aug 2005
Thanks!

"J Ford" <(E-Mail Removed)> wrote in message
news:F788D88B-5A27-4482-8D93-(E-Mail Removed)...
> Here, you click it once it will enable it, you click it again it will

disable
> it:
>
> <script>
> Const HKCU=&H80000001 'HKEY_CURRENT_USER
> Const HKLM=&H80000002 'HKEY_LOCAL_MACHINE
>
> Const REG_SZ=1
> Const REG_EXPAND_SZ=2
> Const REG_BINARY=3
> Const REG_DWORD=4
> Const REG_MULTI_SZ=7
>
> Const HKCU_IE_PROXY = "Software\Microsoft\Windows\CurrentVersion\Internet
> Settings"
>
> Set oReg=GetObject("winmgmts:!root/default:StdRegProv")
>
> Main
>
> Sub Main()
>
> ' If Proxy is set then turn it off
> If GetValue(HKCU,HKCU_IE_PROXY,"ProxyEnable",REG_DWORD) = 1 AND
> Len(GetValue(HKCU,HKCU_IE_PROXY,"ProxyServer",REG_SZ)) > 0 Then
> CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",0,REG_DWORD
> wscript.echo "Proxy Disabled"
> Else
> ' If Proxy is not set then turn it on
>
> strProxyServer = "MyProxySvr:80"
> strProxyOveride = "*.domain.com;*.domain2.com;*domain3.com"
>
> CreateValue HKCU,HKCU_IE_PROXY,"ProxyServer",strProxyServer,REG_SZ
> CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",1,REG_DWORD
> CreateValue HKCU,HKCU_IE_PROXY,"ProxyOverride",strProxyOveride,REG_SZ
> wscript.echo "Proxy Enabled" & vbcrlf & "(" & strProxyServer & ")"
> End If
>
> End Sub
>
> Function CreateValue(Key,SubKey,ValueName,Value,KeyType)
> Select Case KeyType
> Case REG_SZ
> CreateValue =

oReg.SetStringValue(Key,SubKey,ValueName,Value)
> Case REG_EXPAND_SZ
> CreateValue =
> oReg.SetExpandedStringValue(Key,SubKey,ValueName,Value)
> Case REG_BINARY
> CreateValue =

oReg.SetBinaryValue(Key,SubKey,ValueName,Value)
> Case REG_DWORD
> CreateValue =

oReg.SetDWORDValue(Key,SubKey,ValueName,Value)
> Case REG_MULTI_SZ
> CreateValue =
> oReg.SetMultiStringValue(Key,SubKey,ValueName,Value)
> End Select
> End Function
>
> Function DeleteValue(Key, SubKey, ValueName)
> DeleteValue = oReg.DeleteValue(Key,SubKey,ValueName)
> End Function
>
> Function GetValue(Key, SubKey, ValueName, KeyType)
>
> Dim Ret
>
> Select Case KeyType
> Case REG_SZ
> oReg.GetStringValue Key, SubKey, ValueName, Value
> Ret = Value
> Case REG_EXPAND_SZ
> oReg.GetExpandedStringValue Key, SubKey, ValueName,

Value
> Ret = Value
> Case REG_BINARY
> oReg.GetBinaryValue Key, SubKey, ValueName, Value
> Ret = Value
> Case REG_DWORD
> oReg.GetDWORDValue Key, SubKey, ValueName, Value
> Ret = Value
> Case REG_MULTI_SZ
> oReg.GetMultiStringValue Key, SubKey, ValueName, Value
> Ret = Value
> End Select
>
> GetValue = Ret
> End Function
> </script>
>
> "William Hymen" wrote:
>
> > Thanks,
> >
> > But I'm looking for some vbscript samples
> > from someone who has coded a working solution.
> >
> > Thanks anyway!
> >
> > Bill
> >
> > "J Ford" <(E-Mail Removed)> wrote in message
> > news:B7F96ACF-A0E9-40F1-B99C-(E-Mail Removed)...
> > >
> > > Basically just right a script that r/w to the following registry

location
> > >
> > > HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings
> > > ProxyEnable <- REG_DWORD Val '0' Off, '1' On
> > > ProxyOverride <- REG_SZ Val ';' delimited
> > >
> > > Jeremy
> > >
> > > "William Hymen" wrote:
> > >
> > > > I am looking for a hard coded vbscript to plug in
> > > > the company proxy and exclusion list:
> > > > Connections -> LAN settings -> Proxy Server [advanced] [exceptions];
> > > > And another script to "uncheck" all that and enable "Automatically

> > detect
> > > > settings"
> > > >
> > > > We are having problems supporting home
> > > > users who want to connect to the company
> > > > intranet using a VPN client; then later
> > > > disconnect and surf the web using their own ISP.
> > > > (the ISP would use either NO proxy or automatically detect settings.
> > > >
> > > > They all have cable modems and routers using DHCP.
> > > > But we don't support anything beyond the laptop;
> > > > that's up to the home user. ( we don't have enough staff to support
> > > > routers that they buy)
> > > >
> > > > Nothing seems to work except changing the proxy.
> > > >
> > > > Thanks to much in advance.
> > > >
> > > > Bill
> > > >
> > > >
> > > >

> >
> >
> >



 
Reply With Quote
 
New Member
Join Date: Feb 2009
Posts: 1
 
      6th Feb 2009
I have a little question about this thread (sorry for my inexperience).

How can "insert" this script into a BAT / HTML / COM / EXE file to execute him later??

Thanks in advance

PS: sorry for my horrible english

Juan Pablo
 
Reply With Quote
 
New Member
Join Date: Nov 2009
Posts: 1
 
      24th Nov 2009
All you should have to do is just create the batch file and put the VBScript file name on the first line of the batch file.

Although you really don't need the batch file, all they need to do is double click on the VBScript. If this is part of a group of commands you need them to run then you could use the batch file, other than that as I mentioned there is no need for a batch file.
 
Reply With Quote
 
New Member
Join Date: Jun 2011
Posts: 1
 
      16th Jun 2011
did you manage to get this script to work? it doesnt work for me. it executes and nothing happens. Does it depend of the version of IE?
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBscript to change resolution Damo_Suzuki Windows XP Customization 1 9th May 2006 12:01 PM
change ACL of printer with vbscript? Joeri KUMBRUCK Microsoft Windows 2000 Printing 0 28th May 2004 11:10 AM
VBScript to change computer name Tony Microsoft Windows 2000 CMD Promt 2 9th Mar 2004 09:29 AM
How to change VBScript to VB code behind file Sean Microsoft VB .NET 18 14th Aug 2003 03:48 PM
How to change VBScript to VB code behind file Sean Microsoft ASP .NET 5 13th Aug 2003 06:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:24 AM.