I was given the task to track when users log-on and log-off our domain. I found many paid apps but we wanted a free alternative if possible.We were able to track users in the event viewer but it was a mess with to many entries. After searching the net I found a great & simple write up. I tweaked it a bit so each user has its own folder and easier for me to keep track.

Step 1: Create the following two files using Notepad or your favorite text editor:

——logon.cmd—-
echo Log On User: %username% PC: %computername% Date: %date% Time: %time% >> serversharedFolderlogOn_%username%.log

—–logoff.cmd—–
echo Log Off User: %username% PC: %computername% Date: %date% Time: %time% >> serversharedFolderlogOn_%username%.log

Step 2: Update Group Policy to run the appropriate batch file. In Group Policy, go to:
User Configuration-> Windows Settings-> Scripts (Logon/Logoff)-> Attach the files

Step 3: Now when users log on and off, a txt file named LogOn_userName.log will be crated with entries that will look something like this:

Log On – User: ABC PC: CPU Date: Tues 12/27/2011 Time: 16:26:54:35
Log Off – User: ABC PC: CPU Date: Tues 12/27/2011 Time: 17:00:54:35