Log user activity when user logs on

Create a batch file as follows:

@Echo off
echo user: %username% computer: %computername% date: %date% > "\\FILESERVER\SHARE$\User-Logged-On-To\%username% on %computername% %date%.txt"

Name it for example u_on_c.bat

Note: after the date: %date%, the > is the code to output it to another file yet to be created, in this case to:

"\\FILESERVER\SHARE$\User-Logged-On-To\%username% on %computername% %date%.txt"

Put this in GPO:

1. Open Server Management or use “gpedit.msc”. Expand the domain until you find the OU containing all client machines you want to include.

3. Right-click the OU and choose “Create and Link a GPO Here…”. Name it “UC - User Activity”. (UC stands for User Configuration instead of CC: Computer Configuration). Easier to keep the two apart for the OU's.

4. Right-click the new policy and Edit. Browse to User Configuration -> Administrative Templates > Windows Settings -> Scripts -> Startup.

5. Double-click “Startup”. Click on "Open File Location" and copy the file where you saved it from that location to this window. Click on Add and select your u_on_c.bat file. Leave Script Parameters blank and click OK.

6. Make sure the scope is authenticated users or your desired group you want to have this script applied to.