Page 1 of 2 12>
Topic Options
#32730 - 2002-11-18 02:36 PM Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
I am currently working on a script that takes away the proxy address for groups but am not having much success, has anyone managed to do this successfully? Could I have some pointers, thankyou

Heres what I have so far...
code:
 
IF INGROUP("YEAR6")
$rs=WriteValue ("Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
ENDIF
IF INGROUP("YEAR8")
$rs=WriteValue ("Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
ENDIF
IF INGROUP("YEAR9")
$rs=WriteValue ("Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
ENDIF
IF INGROUP("YEAR10")
$rs=WriteValue ("Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
ENDIF
IF INGROUP("YEAR11")
$rs=WriteValue ("Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue ("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
ENDIF



As you can see the "" double quotes should remove the address of the proxy server.

Cheers

Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32731 - 2002-11-18 02:41 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I think you are trying to alter the wrong keys/values.

code:
Function SetAutoProxy ($Proxy)
; This function sets the corporate autoproxy for the client
dim $Proxy, $key, $rc_write, $RC1, $RC2, $RC3, $RC4
$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$RC1=WriteValue($key,"ProxyEnable","0","REG_DWORD")
$RC2=WriteValue($key,"AutoConfigURL",$Proxy,"REG_SZ")
$RC3=WriteValue($key,"ProxyServer","","REG_SZ")
$RC4=WriteValue($key,"ProxyOverride","","REG_SZ")
if ($RC1+$RC2+$RC3+$RC4)>0
$ErrorState=1
WriteLog("Error setting AutoProxy registry settings. 0=success (RC1=$RC1, RC2=$RC2, RC3=$RC3, RC4=$RC4)")
endif
$file = "c:\Program Files\Plus!\Microsoft Internet\CUSTOM\install.ins"
If Exist($file)=1
$rc_write=WriteProfileString($file,"URL","AutoConfigURL",$Proxy)
$rc_write=WriteProfileString($file,"URL","AutoConfigJSURL","")
$rc_write=WriteProfileString($file,"Proxy","HTTP_Proxy_Server","")
$rc_write=WriteProfileString($file,"Proxy","FTP_Proxy_Server","")
$rc_write=WriteProfileString($file,"Proxy","Secure_Proxy_Server","")
$rc_write=WriteProfileString($file,"Proxy","Gopher_Proxy_Server","")
$rc_write=WriteProfileString($file,"Proxy","Socks_Proxy_Server","")
$rc_write=WriteProfileString($file,"Proxy","Proxy_Enable","0")
Endif
Endfunction

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32732 - 2002-11-18 02:42 PM Re: Disabling users access by group.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I'll take liberty to shorten your code.
code:
if ingroup("Year6","Year8","Year9","Year10","Year11")
$rs=WriteValue("Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
$rs=WriteValue("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ")
endif

_________________________
!

download KiXnet

Top
#32733 - 2002-11-18 02:43 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
But since this value/setting can be altered by the user, would it not be better to deny them access to the internet at the proxy server?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32734 - 2002-11-18 02:47 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
The proxy is controllled by the LEA off the site (Local education Authority)

Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32735 - 2002-11-18 02:49 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
You see what im trying to accomplish is a way to stop the users from accessing the internet during their lessons but have it simple enough to put the proxy address back in later!

Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32736 - 2002-11-18 02:50 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I think my code above will get you close.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32737 - 2002-11-18 02:55 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Howard, does your script disable the proxy? This just requires me to replace the 0 with a 1?

Steve
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32738 - 2002-11-18 03:23 PM Re: Disabling users access by group.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Beware that proxy setting could be either per user or per machine.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#32739 - 2002-11-18 03:30 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
My function work to set the Autoproxy field for each user. You call the function with the specific url that defines your autoproxy code. If you want to turn it off, just call the function with a bogus url string ot empty string.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32740 - 2002-11-18 03:34 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Apologies for being stupid what is the custom.ins file for and do I need this Howard?

Steve
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32741 - 2002-11-18 03:38 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
That is the code to support altering the proxy for some Netscape implemetations. I believe it to be like the default config for new users.

No question is stupid. We all have a myriad of issues with which we have to deal. Sometimes in that mix, other peoples' work clicks immediately and sometimes not. No Problem.

[ 18. November 2002, 15:39: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32742 - 2002-11-18 04:22 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Ive tried running your script in debug mode but not able to get past first line.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32743 - 2002-11-18 04:25 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
And your error is?

This is a function supported in KiXtart 4.0 and higher. What version of KixTart are you using?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32744 - 2002-11-18 04:31 PM Re: Disabling users access by group.
Darren_W Offline
Hey THIS is FUN
*****

Registered: 2001-10-10
Posts: 208
Loc: Bristol, England
Hi,

Would it not be better to disable the proxy server with the ProxyEnable Key and prevent access to connection details with windows policies?

eg.

code:
 
;enable proxy
IF INGROUP("YEAR6")

$key="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$rtn=writevalue($key,"ProxyEnable","1","REG_DWORD")

endif

;disable proxy
IF INGROUP("YEAR7")

$key="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
$rtn=writevalue($key,"ProxyEnable","0","REG_DWORD")

ENDIF


Darren
_________________________
I want to share something with you - the three sentences that will get you through life.
Number 1, 'cover for me.'
Number 2, 'oh, good idea, boss.'
Number 3, 'it was like that when I got here'.

Top
#32745 - 2002-11-18 04:34 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
That is already in the code above. One would have to determine if static or autoproxy were to be used and adjust the code accordingly.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32746 - 2002-11-18 04:38 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
It is static proxy Howard, the ver of Kix is 4,0,2

Steve.
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
#32747 - 2002-11-18 04:57 PM Re: Disabling users access by group.
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Being a static proxy setting, Darren's code may be more to the point.

I still do not know why you can't execute my UDF. If you execute your test code in a DOS window, what is displayed?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32748 - 2002-11-18 07:53 PM Re: Disabling users access by group.
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
The registry modifications in HKEY_LOCAL_MACHINE and HKEY_USERS\.DEFAULT will not work under Windows NT/2000/XP if the user doesn't have local administrative privileges.
_________________________
There are two types of vessels, submarines and targets.

Top
#32749 - 2002-11-19 01:09 PM Re: Disabling users access by group.
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
It seems that Internet Explorer is per machine on my 9x clients, so would I modify darrens script to include the LOCAL_MACHINE keys?
_________________________
Dont worry because a rival imitates you. As long as they follow in your tracks they cant pass you!

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 530 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.076 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org