专栏作品
Windows管理员的三大心愿之一限制Windows用户的并发登录
陈流浩
NTName %USERNAME% >%TEMP%\LOGONEDPC.TXT ;重定向到logonedpc.txt文件
If not errorlevel 1 goto Logon_OK
For /f %%f in(‘TYPE %TEMP%\LOGONEDPC.TXT’) do @echo 已经登录到%%f %0..\logout.exe
:Logon_OK
CLS
AT (1,1)
If @INWIN = 2 ; 表示客户计算机是Windows 95/98
$L = "@LSERVER" + "\" + "NETLOGON" + "\" + "WINSET.EXE"
shell "$L USERNAME=@USERID"
shell "$L HOMEDRIVE=X:" ; 你为用户映射的网络驱动器
shell "$L HOMEPATH=@HOMEDIR"
shell "$L HOMESHARE=@HOMESHR"
shell "$L COMPUTERNAME=@WKSTA"
shell "$L USERDOMAIN=@DOMAIN"
shell "$L LOGONSERVER=@LSERVER"
shell "$L USERPROFILE=@HOMESHR"
shell "$L OS=Windows_98"
setl "USERNAME=@USERID"
setl "HOMEDRIVE=X:"
setl "HOMEPATH=@HOMEDIR"
setl "HOMESHARE=@HOMESHR"
setl "COMPUTERNAME=@WKSTA"
setl "USERDOMAIN=@DOMAIN"
setl "LOGONSERVER=@LSERVER"
setl "USERPROFILE=@HOMESHR"
setl "OS=Windows_98"
endif
If @WKSTA <> "@LSERVER" ; 如果客户的工作站不是这台计算机
settime "@LSERVER" ; 把工作站的时间设置成服务器时间
endif
use X: "@HOMESHR" ;这是Kixtart中自带的Net use命令
$S = "@LSERVER" + "\" + "NETLOGON" + "\" + "users.txt"
IF INGROUP("users") and EXIST("$S")
Display "$S"
AT (23,1) "按任何键继续"
GET $A
endif
$B = "@LSERVER" + "\" + "NETLOGON" + "\" + "LOGBAT.BAT"
shell "$B"
CLS
BIG
$X = 1
DO
COLOR w/n
AT ( $X,$X*2 ) "@USERID"
$X = $X+1
UNTIL $X = 6
COLOR g+/n
AT ( $X,$X*2 ) "@USERID"
sleep 3
AT (23,0)
SMALL
$K=”@LSERVER”+”\”+”NETLOGON”+”\”+Onlyonce.txt”
$J=”x:\”+”@USERID”+”.txt”
if exist(“J$”)
goto done
endif
CLS
Display “$K”
Sleep 3
$RC=shutdown(“”,”正在关闭系统!”,0,1,0)
:done
cookie1 ; 需要通知Windows 98计算机当通过LMSCRIPT时脚本已经运行完毕
exit
posted on 2006-07-11 12:51
海之蓝 阅读(327)
评论(0) 编辑 收藏 引用 所属分类:
学习笔记