Friday, 21 December 2012

How to Block Cuncurrent login session through GPO?

If you want to prevent users are login using their credentials in more than one system in your network, we can apply this below scripts VIA GPO to avoid the concurrent login sessions.
Ex
If User A is logged in SYSTEM1, he won’t be able to login another system at the same time, if he wish to login one more, then he should logoff his existing session.
GPO Settings
 
From the User Configuration\Windows Settings\Scripts\Logon and Longoff (Use the below scripts)

Logon Script
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Listing 1: Login.bat
:: BEGIN CALLOUT A
If Exist \\rafetpc\logons\%username%.txt Goto notlogon
Echo %username% logged in from %computername% > \\rafetpc\logons\%username%.txt
Echo %username% logged in from %computername% > \\rafetpc\logons\%computername%.txt
:: END CALLOUT A
Goto end
:notlogon
Logoff
:end
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Logoff Script
Listing 2: Logout.bat
:: BEGIN CALLOUT A
If Not Exist \\rafetpc\logons\%computername%.txt goto notlogon
Del \\rafetpc\logons\%username%.txt
Del \\rafetpc\logons\%computername%.txt
:: END CALLOUT A
Goto end
:notlogon
Logoff
:end
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

No comments:

Post a Comment