Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Proxy settings

118 views
Skip to first unread message

Grant

unread,
May 31, 2004, 12:17:01 AM5/31/04
to
Hello,

Is there a way to set the proxy server of a machine at login? I found the
'SetProxySetting' in the 'Win32_Proxy Class' on the MSDN site but I dont
know how to implement it.


Thanks,
Grant


Mike SMITH

unread,
May 31, 2004, 11:05:04 AM5/31/04
to
Hi Grant

Here is a couple of functions I used to change the registry, see if what
you need is in there ;-)

<snip>

Function DisableProxy()

Set WshShell = WScript.CreateObject("WScript.Shell")
MyValue =
WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\proxyenable")

If MyValue = 1 Then

WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\proxyenable", 0 ,"REG_DWORD"
WshShell.RegWrite "HKLM\Software\Microsoft\Firewall Client\Disable", 1
,"REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\EnableAutoDial", 1 ,"REG_DWORD"
Wshshell.Regwrite
"HKEY_CURRENT_CONFIG\Software\Microsoft\windows\CurrentVersion\Internet
Settings\EnableAutodial", 1 ,"REG_BINARY"

End If


Wscript.echo "Proxy Disabled"

End Function


Function EnableProxy()

Set WshShell = WScript.CreateObject("WScript.Shell")
MyValue =
WshShell.RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\proxyenable")

If MyValue = 0 Then

WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyEnable", 1 ,"REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyServer","myproxy server:<port no>"
WshShell.RegWrite "HKLM\Software\Microsoft\Firewall Client\Disable", 0
,"REG_DWORD"
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\EnableAutoDial", 0 ,"REG_DWORD"
Wshshell.Regwrite
"HKEY_CURRENT_CONFIG\Software\Microsoft\windows\CurrentVersion\Internet
Settings\EnableAutodial", 0 ,"REG_BINARY"

End If

Wscript.echo "Proxy Enabled"

End Function

</snip>

It's from a script I wrote for my laptop when I was at work or from home.
MyValue comes from the result of pinging the proxy.

HTH

Mike

"Grant" <gps...@hotmail.com> wrote in message
news:O$GVhYsRE...@TK2MSFTNGP09.phx.gbl...

Slim

unread,
May 31, 2004, 1:21:48 PM5/31/04
to
dim theProxy
Set theProxy =
GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf("Win32_pr
oxy")
For Each thing In theProxy
thing.SetProxySetting "myserver","myport"
Next

"Grant" <gps...@hotmail.com> wrote in message
news:O$GVhYsRE...@TK2MSFTNGP09.phx.gbl...

Grant

unread,
May 31, 2004, 9:36:43 PM5/31/04
to
Thank you for your help.


"Grant" <gps...@hotmail.com> wrote in message
news:O$GVhYsRE...@TK2MSFTNGP09.phx.gbl...

Grant

unread,
May 31, 2004, 11:04:36 PM5/31/04
to
Thanks for that - how do I enumerate through the list of properties
available for the selection? One of the property values is:
'ProxyPortNumber' but I dont know what the others are? Do you know how to
get these properties or is there a list somewhere to reference?

Thanks,
Grant

"Slim" <Slim@slim> wrote in message
news:%237f2yRz...@TK2MSFTNGP09.phx.gbl...

AlanM

unread,
Jun 1, 2004, 3:43:16 AM6/1/04
to

"Grant" <gps...@hotmail.com> wrote in message
news:uUx0tU4R...@TK2MSFTNGP09.phx.gbl...

> Thanks for that - how do I enumerate through the list of properties
> available for the selection? One of the property values is:
> 'ProxyPortNumber' but I dont know what the others are? Do you know how to
> get these properties or is there a list somewhere to reference?

yes there is,

here is teh pag refereing to the proxy, look at list on left for other
objects nad maby bookmark page

http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_proxy.asp?frame=true

Grant

unread,
Jun 1, 2004, 6:14:44 AM6/1/04
to
Finally! Ive been looking for this page for ages.

Thanks mate.


"AlanM" <noone...@nowhere.com> wrote in message
news:Os3KXv6R...@TK2MSFTNGP12.phx.gbl...

Grant

unread,
Jun 1, 2004, 6:40:44 AM6/1/04
to
Hey Mike, do you know how to enable the 'proxy bypass' setting in the
registry? The 'Win32_Proxy Class' doesnt have that function and I had a
look in my registry at the
'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet
Settings\ProxyByPass' key but it doesnt change wehen I change me internet
explorer settings - so I think Im looking in the wrong place.

Do you know how to set this from script?

Thanks,
Grant


"Mike SMITH" <mi...@nospamtesla76.freeserve.co.uk> wrote in message
news:c9fhl7$6mk$1...@newsfeed.th.ifl.net...

AlanM

unread,
Jun 3, 2004, 5:26:43 AM6/3/04
to

"Grant" <gps...@hotmail.com> wrote in message
news:uHzeJF8R...@tk2msftngp13.phx.gbl...

> Finally! Ive been looking for this page for ages.
>
> Thanks mate.
>


I also got excited about finding that page, its makes it all a bit easier

0 new messages