jamwatn Posted April 12, 2016 Posted April 12, 2016 Hi there, I was wondering if there was a free bit of software out there that sits on the server and can log when a user logs on / off to computers and record the data? It would be nice to track the un-used kit in Primaries that I visit. Thanks!! (PS: I have searched!)
clockend25 Posted April 12, 2016 Posted April 12, 2016 We have batch files that run at logon/logoff and generate and then amend a text file for each user and machine. Originally posted by someone else on here: Logon: rem The following line creates a rolling log file of usage by workstation echo Log In %Date% %TIME% %USERNAME% >> \\SHAREPATH\%COMPUTERNAME%.log rem The following line creates a rolling log file of usage by user echo Log In %Date% %TIME% %COMPUTERNAME% >> \\SHAREPATH\%USERNAME%.log Logoff: rem The following line creates a rolling log file of usage by workstation echo Log Off %Date% %TIME% %USERNAME% >> \\SHAREPATH\%COMPUTERNAME%.log rem The following line creates a rolling log file of usage by user echo Log Off %Date% %TIME% %COMPUTERNAME% >> \\SHAREPATH\%USERNAME%.log
SpuffMonkey Posted April 12, 2016 Posted April 12, 2016 I think you can grab this sort of stuff out of the event logs on the servers if you have it switched on - there are lots of discussions about it like this https://social.technet.microsoft.com/Forums/scriptcenter/en-US/40abcffd-9148-4f0d-8b21-d7f6bcc1d15e/login-out-history-extraction-from-2008r2-event-logs-with-a-powershell-script?forum=ITCG
jamwatn Posted April 13, 2016 Author Posted April 13, 2016 Interesting, I'll probably give the script a go actually. I wish there was a program out there that could do it!!!
Asgard Posted April 13, 2016 Posted April 13, 2016 (edited) We have an in-house app that runs on login that essentially takes the login name, machine name, logon time and throws them into a SQL database. I'm sure I could get you the original Visual Studio code if you wanted Edited April 13, 2016 by Asgard
Sephiroth Posted April 14, 2016 Posted April 14, 2016 I have a vbs script which I ported to Powershell that logs PC name, Username, log on/off, connection server used, date and time to an MSSQL database. I then have a php webpage that reads from the database and gives me searching functionality and adds school period (lesson #) and timestamp. Powershell: $dataSource = "ServerName” $user = “username” $pwd = “password” $database = “dbName” $StrMachineName = [Environment]::MachineName $StrUserName = [Environment]::UserName $Date = Get-Date -UFormat "%Y-%m-%d %T.000" $strLogonOK = "$StrUserName has logged onto $StrMachineName" $LogonServer = $env:LOGONSERVER $connectionString = “Server=$dataSource;uid=$user; pwd=$pwd;Database=$database;Integrated Security=False;” $connection = New-Object System.Data.SqlClient.SqlConnection $connection.ConnectionString = $connectionString $connection.Open() $strSQL = "INSERT INTO tblhistory (pcname,username,datelogged,message,logonserver) VALUES (`'$StrMachineName`',`'$strUserName`',`'$Date`',`'$strLogonOK`',`'$LogonServer`')" $command = $connection.CreateCommand() $command.CommandText = $strSQL $result = $command.ExecuteReader() $connection.Close()
zag Posted April 14, 2016 Posted April 14, 2016 echo %date% %time% %computername% %username% >>\\server\access$\user_log.txt Just add that to their login bat file. Should record all logons to a text file.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now