Here is a script, to log user logins in the local network trough the logon script.
The output is saved in a CSV file format and stored in a network share.
It’s a simple batch file with basic functions. It can be used in various situations to keep track of the computers the user’s login to and work with, or just to gather information and create statistics about the login behavior of the users.
For the script to work you need to create a share with write access to all users.
Change the serverIP and the sharename in the script to reflect the network settings and link the script to the users logon script.
rem please change the server IP and share location rem ---------------------- set serverIP=10.10.10.10 set sharename=userinfo$ rem ---------------------- rem do not change rem ------------------- echo %DATE% %TIME% set MTH=%DATE:~4,2% set DAY=%DATE:~7,2% set YR=%DATE:~10,4% set HR=%TIME:~0,2% set HR0=%TIME:~0,1% if "%HR0%"==" " set HR=0%TIME:~1,1% set MIN=%TIME:~3,2% set SEC=%TIME:~6,2% set MYDATE=%YR%-%MTH%-%DAY%,%HR%:%MIN%:%SEC% set Fdate=%YR%-%MTH%- rem Find IP: rem -------- IPCONFIG |FIND "IP" > %temp%\TEMPIP.txt FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a del %temp%\TEMPIP.txt set IP=%IP:~1% rem Save to file: rem ---------------- echo %MYDATE%,%username%,%COMPUTERNAME%,%IP%,%OSNAME%,%OSVER% >> \\%serverIP%\%sharename%\%fdate%UserLog.csv