Page 1 of 1 1
Topic Options
#36657 - 2003-02-19 03:21 PM Disabling Internet by room number
Billy Offline
Fresh Scripter

Registered: 2002-11-06
Posts: 34
Loc: Birmingham, England
I work at a school where we currently enable and disable the internet by year group, this is done by using the script below:

;disable proxy
If InGroup("YR8")
$rmv = DelKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings")
Shell "regedit /s c:\WINDOWS\disanet.reg"
EndIf

Is there any way of changing the script to enable and disable the internet in room rather than year group. The computers are named by which room they are in. For example, the fourth computer in the room called S5 is call S5-04. Would be extremely grateful if any one can help.

THANX

Top
#36658 - 2003-02-19 03:41 PM Re: Disabling Internet by room number
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yo !



if instr(@wksta,"SearchPattern")
    $rmv = DelKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings")
    Shell "regedit /s c:\WINDOWS\disanet.reg"
endif



[ 19. February 2003, 15:42: Message edited by: jpols ]
_________________________



Top
#36659 - 2003-02-19 03:42 PM Re: Disabling Internet by room number
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
If all computernames have a - between room and pc-number then you could do something like (kix 4.x):

code:
break on
$room=split(@wksta,"-")[0]

select
case S1==ucase($room)
;enable/disable internet

case S2==ucase($room)
;enable/disable internet

case S3==ucase($room)
;enable/disable internet

case S4==ucase($room)
;enable/disable internet

case S5==ucase($room)
;enable/disable internet

case 1
;do nothing

endselect

_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#36660 - 2003-02-20 05:13 PM Re: Disabling Internet by room number
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
I would even put the enable/disable status into a .INI file and use READPROFILESTRING to read/change/check status. Then you don't need to edit the script whne making changes.
code:
; binary values to enable/disable Internet Access
[Rooms]
S1=0
S2=1
S3=0
S4=0
S5=1

code:
$room=split(@wksta,"-")[0]
$status=readprofilestring('status.ini','Rooms',$room)
if $status
; enable Internet access
else
; disable Internet access
endif

_________________________
There are two types of vessels, submarines and targets.

Top
#36661 - 2003-03-14 12:20 AM Re: Disabling Internet by room number
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Is there anyway of using the @worksta macro to determine what room the machine is in?

Maybe if I use something like SET Room=S5 for all machines that are in S5. Then kix checks this is true in the config.sys file reads this if the condition is true then runs a script to disable the proxysever...

Is this possible

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

Top
#36662 - 2003-03-13 01:04 PM Re: Disabling Internet by room number
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Perhaps a READPROFILESTRING command something like;
code:
 
$rd = ReadProfileString("c:\autoexec.bat", "", "ROOM")
If $rd="ITOFF"
? "read this string result is " + $rd
Endif

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

Top
#36663 - 2003-03-13 01:36 PM Re: Disabling Internet by room number
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ummmmm -...- *tilt
_________________________



Top
#36664 - 2003-03-13 01:40 PM Re: Disabling Internet by room number
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ok, bypassed my stack overflow [Big Grin]

Stephen:

1. -> Yes there is a way to determine the room number by @wksta macro (but only the Workstation names contain the room number)

2. -> Redprofilestring in Autoexec.bat won't work as Autoexec.bat is far away from ini format ...

3. -> do NOT hijack others posts [Wink]
_________________________



Top
#36665 - 2003-03-13 01:56 PM Re: Disabling Internet by room number
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
JPOLS,

THANKS FOR YOUR COMMENTS, THOUGH BILLY IS MY TECHNICIAN.

ReadProfileString will work in INI format is this possible for one of these to include ROOM=S5 ETC
this way I an use kix to detemine the room the computers are in...

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

Top
#36666 - 2003-03-13 02:13 PM Re: Disabling Internet by room number
Stephen Wintle Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 444
Loc: England
Have got a solution used win.ini...

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

Top
#36667 - 2003-03-13 02:17 PM Re: Disabling Internet by room number
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
ah ok ... can't smell that [Wink]

Billy stated :

quote:
The computers are named by which room they are in. For example, the fourth computer in the room called S5 is call S5-04
so the possible scriptlet (using at least KiX 4.20) would be :

ini-file used to determine which are enabled :

code:
[RoomsEnabled]

Rooms=S5,S4,S3

Script to run :



break on

$ini = "[path]\inifile.ini"

$enabled = split(readprofilestring($ini"RoomsEnabled" , "Rooms"), ",")

if ascan($enabledsubstr(@wksta,1,2) ) > -1 ; first 2 chars of Workstationname
                                             ; matches one of the elements of $enabled
      ; do the appropriate step to enable here!                                       
else ; disable!
    $rmv = delkey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings")
    Shell "regedit /s c:\WINDOWS\disanet.reg"   
endif



hth

[ 13. March 2003, 14:19: Message edited by: jpols ]
_________________________



Top
#36668 - 2003-03-13 04:34 PM Re: Disabling Internet by room number
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Which is pretty much identical to what I proposed. I just have each room separately with a binary value determining whether it's Internet-enabled or not. This will make it easier to retrieve the room status.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.077 seconds in which 0.046 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