Just say you want to audit domain log on and log offs within your  network. This is always a good idea to ensure that you know who is logging into what and when. I have used this method in a number of places and it has always proven to be useful for both monitoring user honesty (They worked when they said they did), and accountability (Seeing who accessed what server)

Here is the steps to get this up and running

  • Create a folder in a generally accessible network share. I am going to create a folder called LOOAudit within the NETLOGON share within the domain SYSDOMAIN to allow general access and sync between domain controllers.
  • Optionally you can also create a hidden share on one of your servers to receive the data. I am going to create a hidden share called LOOAudit$ on a server called MAIN to receive the data.
  • Create a text file in the LOOAudit folder called LogoffLog.cmd with contents listed below.

  • Create a text file in the LOOAudit folder called LogonLog.cmd with the contents listed below.

  • Open the group policy management console and create a new group policy object called ‘AUDIT – Log on – off’
  • Edit the group policy object and add the following information.
    • User Configuration -> Policies -> Windows Settings -> Scripts -> Logon = \\SYSDOMAIN\netlogon\LOOAudit\LogonLog.cmd
    • User Configuration -> Policies -> Windows Settings -> Scripts -> Logoff = \\SYSDOMAIN\netlogon\LOOAudit\LogoffLog.cmd
  • Assign the group policy object to the appropriate locations within the domain (You may want to apply this at the root of the domain to monitor the entire network, or alternatively assign it to a specific set of users or workstations)
  • Perform a log on and log off to a monitored machine to ensure that the files are being updated.

The script will automatically create and update a file for each username in the \\MAIN\LOOAudit$ share. If you need to see when a user has logged on or off and to what machine you can open their file and see the times that they signed in and out as per the example below. (This document can be opened in Excel to perform filtering)

Remember that if a user is logging into multiple machines (Or hoping from terminal to server etc) then the log on’s and off’s will not be in order.