#173488 - 2007-02-01 04:07 AM
Script to change Proxy address and remove connection tab
|
sgraham978
Fresh Scripter
Registered: 2007-02-01
Posts: 11
|
Not sure if this is possible or not, but what I would like to do is write a script that would check the ip address of a computer, then if it determines that it's on our network it would set the proxy address to a particular address and then disable the connection tab. If it doesn't find an address on our network then it changes the proxy to blank and leaves the tab.
Is it possibel to write a kix script to do the above or am I asking too much???
|
|
Top
|
|
|
|
#173492 - 2007-02-01 05:12 AM
Re: Script to change Proxy address and remove connection tab
[Re: Les]
|
sgraham978
Fresh Scripter
Registered: 2007-02-01
Posts: 11
|
The login script starts up automatically when people log in. When the laptop users are not connected to the network then they obviously won't get the login script, although what I was thinking of doing was putting it on their machines locally so that when the start the computers up off the network then they still get the script. That was the plan anyway, of course if there's a better way of doing it then I'm happy to do it another way.
The reason I wanted to automate it all in the script was because when the laptop users go offsite they generally need to turn the proxy off, but when they come back into the office they need to turn it on again. A lot of them either forget or don't want to have the hassle and then some just don't turn it back on at all when in the office and they end up using our dedicated internet link for emails etc instead of the account for browsing the internet. So, I wanted to automate it so that when they're out of the office it automatically switches over then when they're in the office it switches back without them having to do anything.
|
|
Top
|
|
|
|
#173495 - 2007-02-01 06:36 AM
Re: Script to change Proxy address and remove connection tab
[Re: sgraham978]
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11631
Loc: CA
|
|
|
Top
|
|
|
|
#173499 - 2007-02-01 08:01 AM
Re: Script to change Proxy address and remove connection tab
[Re: Witto]
|
sgraham978
Fresh Scripter
Registered: 2007-02-01
Posts: 11
|
Cool, thanks everyone. I'll have a look at that.
|
|
Top
|
|
|
|
#173500 - 2007-02-01 08:59 AM
Re: Script to change Proxy address and remove connection tab
[Re: sgraham978]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
|
|
Top
|
|
|
|
#173502 - 2007-02-01 11:55 AM
Re: Script to change Proxy address and remove connection tab
[Re: Witto]
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
In my environment can't do that. We have VPN users and ALL HTTP traffic MUST go through proxy... so they they can report on staff activity.
In this case a network detection client (detect new connection), determine subnet, if subnet=work then set proxy else no proxy, loop) would do it.
He could even add in a "run logon script" to it
Most of the code is in a " Network (and wireless) disconnector " post I made a month or so ago
|
|
Top
|
|
|
|
#173509 - 2007-02-01 04:34 PM
Re: Script to change Proxy address and remove connection tab
[Re: Radimus]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
The script like in wpad.dat stays the same, but you deploy is as an "Automatic Configuration Script". The script file extension should be PAC file (not DAT like for the wpad server). Maybe you can work with a logon script and a logoff script. Maybe this can help: http://www.adminscripteditor.com/scriptlibrary/view.asp?id=377
|
|
Top
|
|
|
|
#174906 - 2007-03-23 03:08 AM
Re: Script to change Proxy address and remove connection tab
[Re: Witto]
|
sgraham978
Fresh Scripter
Registered: 2007-02-01
Posts: 11
|
Just letting you all know that I've finally written a script that does what I want it to do with regards to proxies...in case anyone would like to know I've pasted the code below..
Code ------------------------------------------- DIM $SUBNET $SUBNET = SUBSTR(@IPADDRESS0,1,8) If $SUBNET = "Your IP Address" $key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" WRITEVALUE($key,"ProxyEnable","1","REG_DWORD") WRITEVALUE($key,"ProxyServer","proxy:8080","REG_SZ") WRITEVALUE($key,"ProxyOverride", "<local>", "REG_SZ") Else $key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" WRITEVALUE($key,"ProxyEnable","0","REG_DWORD") EndIf ------------------------------------------------
Thanks to everyone who responded...much appreciated.
|
|
Top
|
|
|
|
#176341 - 2007-05-18 10:28 AM
Re: Script to change Proxy address and remove connection tab
[Re: sgraham978]
|
PeckMan
Fresh Scripter
Registered: 2007-05-18
Posts: 8
Loc: Austria
|
Just letting you all know that I've finally written a script that does what I want it to do with regards to proxies...in case anyone would like to know I've pasted the code below..
Code ------------------------------------------- DIM $SUBNET $SUBNET = SUBSTR(@IPADDRESS0,1,8) If $SUBNET = "Your IP Address" $key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" WRITEVALUE($key,"ProxyEnable","1","REG_DWORD") WRITEVALUE($key,"ProxyServer","proxy:8080","REG_SZ") WRITEVALUE($key,"ProxyOverride", "<local>", "REG_SZ") Else $key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" WRITEVALUE($key,"ProxyEnable","0","REG_DWORD") EndIf ------------------------------------------------
Thanks to everyone who responded...much appreciated.
Hello @ all
I'm new at this forum and need your help because I don't come along with this code. I was searching exactly for an IE proxy solution like this because we need different 'proxy override' options for our inner office user and our field force user.
My problem, it seams the ip address can not be checked because only the 'Else' function works. The script should check if the ip address is a 10.43.1.* address and then should write the 'proxy override' value in the registry. All our other ip addresses like 10.43.2.*, 10.43.3.*, 10.43.4.* and so on should get the 'Else' values.
What's going wrong here?
Thanks in advance for your help.
Edited by PeckMan (2007-05-18 10:32 AM)
|
|
Top
|
|
|
|
#176342 - 2007-05-18 10:50 AM
Re: Script to change Proxy address and remove connection tab
[Re: PeckMan]
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
Actually you should start your own thread, explain your wishes/problem and include a link to this but it's too late for that now.
This should work.
Dim $SUBNET
$SUBNET = Left(@IPADDRESS0, 12)
If $SUBNET = " 10. 43. 1."
$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
WriteValue($key,"ProxyEnable","1","REG_DWORD")
WriteValue($key,"ProxyServer","proxy:8080","REG_SZ")
WriteValue($key,"ProxyOverride", "<local>", "REG_SZ")
Else
$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
WriteValue($key,"ProxyEnable","0","REG_DWORD")
EndIf
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.
|
|
Top
|
|
|
|
#176343 - 2007-05-18 11:19 AM
Re: Script to change Proxy address and remove connection tab
[Re: Mart]
|
PeckMan
Fresh Scripter
Registered: 2007-05-18
Posts: 8
Loc: Austria
|
Thank you very much for the quick answers.
I'll check your solution and sorry, I thought continuing this thread will be easier than creating a new one. I'll remind this for the future.
Edited by PeckMan (2007-05-18 11:19 AM)
|
|
Top
|
|
|
|
#176344 - 2007-05-18 11:42 AM
Re: Script to change Proxy address and remove connection tab
[Re: PeckMan]
|
Mart
KiX Supporter
   
Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
|
....
sorry, I thought continuing this thread will be easier than creating a new one. I'll remind this for the future.
Don't worry. We all make mistakes sometimes. 
Tweaked it a bit.
Dim $SUBNET, $key
$SUBNET = Left(@IPADDRESS0, 12)
$key = "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
If $SUBNET = " 10. 43. 1."
$rc = WriteValue($key,"ProxyEnable","1","REG_DWORD")
$rc = WriteValue($key,"ProxyServer","proxy:8080","REG_SZ")
$rc = WriteValue($key,"ProxyOverride", "<local>", "REG_SZ")
Else
$rc = WriteValue($key,"ProxyEnable","0","REG_DWORD")
EndIf
Edited by Mart (2007-05-18 11:45 AM)
_________________________
Mart
- Chuck Norris once sold ebay to ebay on ebay.
|
|
Top
|
|
|
|
#176345 - 2007-05-18 12:06 PM
Re: Script to change Proxy address and remove connection tab
[Re: Mart]
|
PeckMan
Fresh Scripter
Registered: 2007-05-18
Posts: 8
Loc: Austria
|
Thank you very much, Mart.
Your first solution already works perfectly. So only the 'Substr' function was the mistake.
The tweaked code looks nice. I think, I'll use this code
|
|
Top
|
|
|
|
#176424 - 2007-05-23 05:34 PM
Re: Script to change Proxy address and remove connection tab
[Re: Mart]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
You forgot his ProxyOverride value's
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(AndreLuiz)
and 509 anonymous users online.
|
|
|