Tuesday, December 20, 2011

Limit Login script for Windows Server 2008

net use Y: \\newton\%username%$
if errorlevel 1 goto logoff
goto continue
:logoff
net send localhost "You are logged in elsewhere. Please log off a the other terminal before trying again."
logoff
:continue
setx homedrive "Y:"
setx homepath "\"

save the above lines to bat file use GPO login script file.

updated script if Y drive already exists

if exist Y:\ goto continue
:logoff
net send localhost "You are logged in elsewhere. Please log off a the other terminal before trying again."
logoff
exit
:continue
setx homedrive "Y:"
setx homepath "\"
exit

No comments: