Hey Everyone,

The forums have been an excellent resource & I can't lurk anymore. I just read what Kdyer posted here and I realized that I should share my most recent bit of KiXtart script.

Using what I read in this thread, (including the other threads linked herein) & some I searched for, and from the info JSIinc, after some work, it works really well.

FYI We're a Public School District, Win2k shop (Active Directory, Exchange 2k, Win2k Pro on the desktops, a few 9x & XP Pro boxes, but not for the students--all W2K pro). We were asked to limit concurrent logons for high school students, after the principal learned students who weren't supposed to be logging on, were. Of course, the easiest & most cost-effective way to do this without buying 3rd party software, was with KiXtart (Mike Myers in the background "Kix, yeah baby!")

Now that I've put you to sleep with the background, here's the script. Thanks to everyone who posts. You guys are lifesavers. If you have any feedback, please leave it. [Smile]
Apologies if the code is too wide, I tried to shorten it....
code:
:BlockConcurrent
;
;block concurrent logons
;

If (InGroup("2002group") or InGroup("2003group"))
gosub ConcurrentLogoff
else
If (InGroup("2004group") or InGroup("2005group"))
gosub ConcurrentLogoff
else
? "you are not a HHS student"
endif
endif
RETURN

;Rem ConcurrentLogoff is not called by main, rather from the BlockConcurrent subroutine
:ConcurrentLogoff
shell @ldrive + "\gotcha.bat" ;run ntname and capture the output to a text file in
;the user's %temp% dir
If open( 3, "%temp%\otherpc.txt" ) = 0
$y = ReadLine(3)
If $y = "" ;they're ok
? "It appears that this is the only PC you're currently logged on to."
else
$logoff = 1 ;log 'em off!
? "It appears as though you are already logged on to $y"
? "bummer!"
gosub ForceLogoffLog
messagebox ("You appear to be logged on to '$y'. You are not authorized
to log on to more than one workstation at a time. You must first log off
'$y'.", "Warning! Concurrent Logons Prohibited", 16, 7)
gosub ForceLogoff
LogOff(1)
EndIf
Close (3)
else
If Open( 2 ,"\\server\LogonLogs$\" + "ErrorLog.TXT", 5 ) = 0
$x = WriteLine( 2 ,@userid + ", " + @FullName + ", " + @Comment + ", could not
open otherpc.txt locally from " + @Wksta + ", " + "at " + @time + " " +
@date + ", " + $IPAddress + ", " + @address + ", " + @LServer
+ ", " + $ConnectionType + ", " + $Ver + Chr(13) + Chr(10) )
$l = Close(1)
endif
EndIf
RETURN


:ForceLogoffLog
If Open( 1 ,"\\server\LogonLogs$\" + @year + "_" + @MonthNo + "_DuplicateLogon" +
".TXT", 5 ) = 0
$x = WriteLine( 1 ,@userid + ", " + @FullName + ", " + @Comment + ", tried to log
on to " + @Wksta + ", but was already on " + $y + " at " + @time + " " +
@date + ", " + $IPAddress + ", " + @address + ", " + @LServer + ", " +
$ConnectionType + ", " + $Ver + Chr(13) + Chr(10) ) $l = Close(1)
Endif
RETURN

Incase anyone wants to know what "Gotcha.bat" looks like, it's just
code:
@echo off
%0\..\NTNAME.EXE %USERNAME% >%TEMP%\OTHERPC.TXT
exit

The only routine called is "BlockConcurrent".
"ntname.exe" works fine, one oddity, the script doesn't seem to work on Windows XP Professional (which we have in limited trials around our district. Since students never use any of these, it's fine. It may become an issue in the future). Other than that, no worries.

Thanks again!

[ 17 July 2002, 03:32: Message edited by: martums ]