• Home
  • About
    • Disclaimer
  • Archives
  • Tools

Logging user login activity through logon script.

May16
2011
Written by david

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
VN:F [1.9.20_1166]
please wait...
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
Posted in Command Line, How To:, Windows - Tagged CMD, Command Line, How to, windows
SHARE THIS Twitter Facebook Delicious StumbleUpon E-mail
Similar posts
  • Super Control Panel (God Mode) on Win... — I found it on the web and I think it’s a great tool...
  • Windows Error Reporting (WER) and low... — I don’t use Widows Error Reporting service and it appears...
  • Windows Server 2008 R2, after install... — After installing Service Pack 1 on a few of my Windows 20...
  • Fix Event ID: 13555 — I got this error during a migration test of an SBS2003 to...
  • How to: shrink an SQL log file. — Once in awhile I meet an sql based program that won’...
« Open source/free network monitoring tools.
» Windows 2008 R2 SP1 x64Bit Remote Desktop Services and 32bit ODBC.

Categories

  • Command Line (11)
  • Exchange (8)
    • 2007 (4)
    • 2010 (5)
  • Fortigate (10)
  • FreeNAS (2)
  • HmailServer (1)
  • How To: (8)
  • MS SQL 2008 (4)
  • Networking (4)
  • Open Source (1)
  • PowerShell (2)
  • Recovery (1)
  • SBS (8)
    • SBS 2008 (6)
    • SBS 2011 (3)
  • Terminal Server (2)
  • Veeam (2)
  • VMware (6)
  • Windows (18)

Links

  • חי הדפסות – דפוס משי, חולון
  • שלישיה – זה לא מה שחשבתם

Archives

  • March 2018
  • January 2018
  • September 2015
  • January 2015
  • August 2014
  • May 2014
  • December 2013
  • January 2013
  • October 2012
  • September 2012
  • July 2012
  • June 2012
  • May 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
Site Meter

EvoLve theme by Theme4Press  •  Powered by WordPress How to do.....IT