It works!
For who cares this is the script:
$message="Er is al iemand met deze loginnaam op het netwerk ingelogd, je wordt nu uitgelogd." +chr(13)+ "Vraag je docent naar je goede loginnaam of laat je docent contact opnemen met systeembeheer."$LoggedOnTo=READPROFILESTRING ("h:\once.txt", "Garfield", "LoggedOnTo")
If @error <> 0 goto "write" Endif
If $LoggedOnTo = @wksta goto "end" Endif
? "Bezig met zoeken op netwerk..."
shell "%comspec% /c NBTSTAT -a $LoggedOnTo > h:\nbt.txt"
? "Klaar"
If Open(1, "h:\nbt.txt") = 0
$x = ReadLine(1)
WHILE @ERROR = 0
If instr($x, @userid)
messagebox($message,"Hoi @userid",016)
SHELL "rundll32.exe shell32.dll,SHExitWindowsEx 5"
Endif ; from instr
$x = ReadLine(1)
LOOP
Close(1)
ELSE
? "Bestand H:\NBT.TXT niet gevonden, waarschuw de netwerkbeheerder: Errorcode " + @ERROR ;+ ""
ENDIF
:write
WRITEPROFILESTRING ("h:\once.txt", "Garfield", "LoggedOnTo", @WKSTA)
:end
------------------
http://www.sanderwinkel.com