#32730 - 2002-11-18 02:36 PM
Disabling users access by group.
|
Stephen Wintle
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
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
|
Top
|
|
|
|
#32732 - 2002-11-18 02:42 PM
Re: Disabling users access by group.
|
Lonkero
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
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?
|
Top
|
|
|
|
#32734 - 2002-11-18 02:47 PM
Re: Disabling users access by group.
|
Stephen Wintle
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
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
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I think my code above will get you close.
|
Top
|
|
|
|
#32737 - 2002-11-18 02:55 PM
Re: Disabling users access by group.
|
Stephen Wintle
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
|
|
|
|
#32739 - 2002-11-18 03:30 PM
Re: Disabling users access by group.
|
Howard Bullock
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.
|
Top
|
|
|
|
#32740 - 2002-11-18 03:34 PM
Re: Disabling users access by group.
|
Stephen Wintle
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
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 ]
|
Top
|
|
|
|
#32742 - 2002-11-18 04:22 PM
Re: Disabling users access by group.
|
Stephen Wintle
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
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?
|
Top
|
|
|
|
#32744 - 2002-11-18 04:31 PM
Re: Disabling users access by group.
|
Darren_W
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
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.
|
Top
|
|
|
|
#32746 - 2002-11-18 04:38 PM
Re: Disabling users access by group.
|
Stephen Wintle
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
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?
|
Top
|
|
|
|
#32749 - 2002-11-19 01:09 PM
Re: Disabling users access by group.
|
Stephen Wintle
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 868 anonymous users online.
|
|
|