|
Disabling users access by group.
|
|
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.
|
|
Re: Disabling users access by group.
|
|
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
|
Lonkero
|
(KiX Master Guru)
|
2002-11-18 02:42 PM
|
|
|
|
|
Re: Disabling users access by group.
|
|
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
|
|
Re: Disabling users access by group.
|
|
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?
|
|
Re: Disabling users access by group.
|
|
The proxy is controllled by the LEA off the site (Local education Authority)
Steve.
|
|
Re: Disabling users access by group.
|
|
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.
|
|
Re: Disabling users access by group.
|
|
I think my code above will get you close.
|
|
Re: Disabling users access by group.
|
|
Howard, does your script disable the proxy? This just requires me to replace the 0 with a 1?
Steve
|
Les
|
(KiX Master)
|
2002-11-18 03:23 PM
|
|
|
|
|
Re: Disabling users access by group.
|
|
Beware that proxy setting could be either per user or per machine.
|
|
Re: Disabling users access by group.
|
|
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.
|
|
Re: Disabling users access by group.
|
|
Apologies for being stupid what is the custom.ins file for and do I need this Howard?
Steve
|
|
Re: Disabling users access by group.
|
|
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 ]
|
|
Re: Disabling users access by group.
|
|
Ive tried running your script in debug mode but not able to get past first line.
|
|
Re: Disabling users access by group.
|
|
And your error is?
This is a function supported in KiXtart 4.0 and higher. What version of KixTart are you using?
|
Darren_W
|
(Hey THIS is FUN)
|
2002-11-18 04:31 PM
|
|
|
|
|
Re: Disabling users access by group.
|
|
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
|
|
Re: Disabling users access by group.
|
|
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.
|
|
Re: Disabling users access by group.
|
|
It is static proxy Howard, the ver of Kix is 4,0,2
Steve.
|
|
Re: Disabling users access by group.
|
|
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?
|
|
Re: Disabling users access by group.
|
|
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.
|
|
Re: Disabling users access by group.
|
|
It seems that Internet Explorer is per machine on my 9x clients, so would I modify darrens script to include the LOCAL_MACHINE keys?
|
|
Re: Disabling users access by group.
|
|
Used the following and STILL am able to connect to the internet.. What could be causing this? Is their anything that im missing. Any help much appreciated.
code:
IF INGROUP("Administrators") $key="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $rtn=writevalue($key,"ProxyEnable","0","REG_DWORD") ? "Net disabled.." $key="HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings" $rtn=writevalue($key,"ProxyEnable","0","REG_DWORD") ? "Net disabled.." $rs=WriteValue ("HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ") ? "Net disabled.." $rs=WriteValue ("HKEY_LOCAL_MACHINE\Enum\Network\MSTCP\0001\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "", "REG_SZ") ? "Net disabled.."
The odd thing is all of the keys have been updated..
Many thanks
Steve
|
|
Re: Disabling users access by group.
|
|
don't know your environment: are your running an autoproxy script as it uses different registry values; do you use a proxy at all?; could the pages you see be from the local cache?
|
|
Re: Disabling users access by group.
|
|
No proxy script, but their is a volera box that does the web caching, this box acts as the proxy.. Then volera redirects through to our ISP Ill check to see if it is viewing cached only...
Steve
|
|
Re: Disabling users access by group.
|
|
No its getting through on cached/non cached..
Strange..
|
|
Re: Disabling users access by group.
|
|
Have you rebooted the client after making the changes?
|
Darren_W
|
(Hey THIS is FUN)
|
2002-11-19 03:24 PM
|
|
|
|
|
Re: Disabling users access by group.
|
|
Hi,
What is your settings in internet explorer's Connection and LAN Settings?
Are they affected by running the script?
If you manualy unswitch the ProxyEnable box (First box under Proxy Server) does this enable/disable internet access?
Darren
|
|
Re: Disabling users access by group.
|
|
YES! It works fine when you type this in manually!
|
Darren_W
|
(Hey THIS is FUN)
|
2002-11-19 04:51 PM
|
|
|
|
|
Re: Disabling users access by group.
|
|
Hi,
The only thing I could think of is the timing of running the script, I generaly exacute the proxy settings after the user has logged in with runonce which is set in the inital script that runs.
eg.
code:
; Once login in sequence complete, i.e. user.dat downloaded to PC, run login1.kix $key="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce" $rtn=writevalue($key,"kix","kix32 \\server\netlogon\login1.kix","reg_sz")
Perhaps this could solve your problem?
Darren
|
|
Re: Disabling users access by group.
|
|
I do run the script after log on (also I have this script loading HKEY_CURRENT_USER keys into the reg from a shell successfully) and although it does return a 'key loaded' string it still does not change the reg key!
Ive posted the whole script. code:
SetConsole ("HIDE") IF @USERID="MARGARET.COX" AND @DATE="2002/10/10" PLAY "0g256t 0g4d1047f f 1g8d1175f 1047f 1397f 2g16d1319f 0g4d1047f f 1g8d1175f 1047f 1568f 2g16d1397f 0g4d1047f f 1g8d2093f 1760f 1397f 1319f 2g16d1175f 0g6d1865f f 1g11d1760f 1397f 1568f 3g21d1397f256t 0g 18d 0ffff 2d" ENDIF If @DAY = "Friday" call "c:\windows\cleanup.kix" ENDIF
;---------------------------------------Removes internet access ---------------------------- ;disable proxy IF INGROUP("Administrators") shell "regedit /s c:\windows\disanet.reg" ? "Key loaded" ; this doesnt work! ENDIF IF INGROUP("YEAR8") shell "regedit /s c:\windows\disanet.reg" ENDIF IF INGROUP("YEAR9") shell "regedit /s c:\windows\disanet.reg" ENDIF IF INGROUP("YEAR10") shell "regedit /s c:\windows\disanet.reg" ENDIF IF INGROUP("YEAR11") shell "regedit /s c:\windows\disanet.reg" ENDIF ;------------------- Deletes Key First---------------------------- $rmv = DelKey("HKEY_CURRENT_USER\Identities") If $rmv = 0 ? "Key deleted..." Endif ;----------------- loadKey from c: --------------------------------------------- shell "regedit /s c:\windows\outlook.reg" ? "key loaded" ; works fine!
;----------------- loadKey from c: --------------------------------------------- shell "regedit /s c:\windows\internet.reg" ? "key loaded"
$hidedrv="HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies" IF (WriteValue("$hidedrv"+"\Explorer","NoDrives","8650812",REG_DWORD) <> 0) ? "Warning "@error+": "@serror ENDIF $pubsve="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Publisher" IF (WriteValue("$pubsve","DefaultPath","H:","REG_SZ") <> 0) ENDIF ;----------------------------- Showing Username in Internet Exp--------------------------------------------- $rs=WriteValue ("Software\Microsoft\Internet Explorer\PageSetup", "header", "@FULLNAME&bPage &p of &P", "REG_SZ") $rs=WriteValue ("Software\Microsoft\Internet Explorer\PageSetup", "footer", "&u", "REG_SZ") ;------------------------------ Inserting Fullname and email address in outlook----------------- $rs=WRITEVALUE ("Identities\{00000001-0000-0000-0000-000000000000}\Software\Microsoft\Internet Account Manager\Accounts\00000002", "SMTP Display Name", "@FULLNAME", "REG_SZ") $add=@USERID+"@@HOLTE.BHAM.SCH.UK" IF(WriteValue("Identities\{00000001-0000-0000-0000-000000000000}\Software\Microsoft\Internet Account Manager\Accounts\00000002", "SMTP Email Address", "$add", "REG_SZ") <> 0) ENDIF ;----------------------- Setting favorites --------------------------------------------- IF (WRITEVALUE("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders","Favorites","H:\MyWork\AppData\Favorite","REG_SZ") <> 0) ENDIF cd windows shell "%comspec% /c deltree /Y c:\windows\*.bmp" ; - homepage - $ikey="HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" IF (ExistKey($ikey) = 0) IF ($debug_mode = "yes") ? "input -> ["+$ikey+"]" ENDIF ; $default_start_page="http://www.holte.bham.sch.uk" ; - set it to your homepage - $ikey_ex="Start Page" $ivalue=ReadValue($ikey, $ikey_ex) IF (ExistKey($ikey+"\"+$ikey_ex) = 0) $result_data_type=ReadType($ikey, $ikey_ex) ELSE $result_data_type="REG_SZ" ENDIF IF ($debug_mode = "yes") ? " "+$ikey_ex+"="+ReadValue($ikey, $ikey_ex)+" "+ReadType($ikey, $ikey_ex) ENDIF IF ($ivalue <> $default_start_page) IF (writevalue($ikey, $ikey_ex, $default_start_page, $result_data_type) = 0) IF (writevalue($ikey, $ikey_ex, $default_start_page, "REG_SZ") = 0) ENDIF $info=$info+" IExplorer.Start_Page[old]=('"+$ivalue+"' > '"+$default_start_page+"')" ENDIF ENDIF ENDIF ? "Update completed. Result: "+$info cookie1 EXIT
Its a shame because im so close to getting this to work!! [ 20. November 2002, 14:01: Message edited by: Howard Bullock ]
|
Lonkero
|
(KiX Master Guru)
|
2002-11-20 02:24 PM
|
|
|
|
|
Re: Disabling users access by group.
|
|
which one is the not loading one? if outlook, can't help.
|
|
Re: Disabling users access by group.
|
|
This is bizzarre!! Ive exported the key before doing this ive manually disabled the ProxyServer (set it to value 0) exported this to the root of C:\ (called it disanet.reg) the branch being, HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings. Ive then run the following (after manually deleting the branch!) code:
;disable proxy IF INGROUP("Administrators") $rmv = DelKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings") If $rmv = 0 ? "Key deleted..." Endif shell "regedit /s c:\disanet.reg" ? "Key loaded" ENDIF
If I load this key through the script it sets the value of ProxyServer to 1 if I merge the key manually (by right clicking on it) it does excactly what I want and sets it to 0... Im going mad!!!
Steve
|
|
Re: Disabling users access by group.
|
|
Since posting the last post I noticed I had put an addional endif in the script ive since taken this out and it still is behaving in the same way...
Steve
|
|
Re: Disabling users access by group.
|
|
Does it still not work after applying the registry changes and rebooting the computer?
|
|
Re: Disabling users access by group.
|
|
Thanks for everybodies help, I managed to get it working in the end. The problem was I was trying to run the Ingroup function using global groups in a 9x environment (I had to create a few local groups for each of my year groups is all!) It pays to read the manuall!!!
Cheers
|
|
Re: Disabling users access by group.
|
|
Do you run the KiXtart RPC Service? There are posts in the FAQ Forum with regards to the RPC Service and Windows 9x support. Worth reading, too.
|