For Active directory user’s logon and logoff reports, it needs the third party tools. But in windows have that capability. Most of the IT professionals are not learned DOS commands in-depth. The DOS command does this process. All are heard about echo command; this command can do the report for our need.
Go to your command prompt, type the below following command.
Echo %username% is logged on to %computername% at %time%
The above command gives the output like his name, computer name and login time. Our need is to generate report for all users, so here we need to create a logon batch file script. Before creating the batch file, we need to create a central repository for storing the log files. Create a hidden share for logon, logoff and give the permission to users.Batch file for logon script Copy the below code edit the systemname, sharename and paste into the notepad, then save it as batch (.bat) file.
Echo %username% is logged on to %computername% at %time% >> \\systemname\Sharename$\%username%_logon.csv
The batch file needs to put on the logon script in the group policy. All log files will be save in separate for each users. Please find the below image, that was the output.
For Log off report use the below command for batch file
Echo %username% is logged on to %computername% at %time% >> \\systemname\Sharename$\%username%_logoff.csv
Copy the above code and create a batch file, apply on the logoff script in the group policy.