Jump to content

Recommended Posts

Posted

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!)

Posted

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

Posted (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 by Asgard
Posted

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()

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...