Wednesday, December 21, 2011

Prevent Multiple Logins via Group Policy in Server 2008

The below loing.bat file is given to userlogin script GPMC

Login.bat

If Exist \\server\logons\%username%.txt Goto notlogon
Echo %username% logged in from %computername% > \\server\logons\%username%.txt
Echo %username% logged in from %computername% > \\server\logons\%computername%.txt
Goto end
:notlogon
Logoff
:end

The below logout.bat file is given to user logout script GPMC

Listing 2: Logout.bat

If Not Exist \\rafetpc\logons\%computername%.txt goto notlogon
Del \\server\logons\%username%.txt
Del \\server\logons\%computername%.txt
Goto end
:notlogon
Logoff
:end

No comments: