ICC Home  /  Members  /  Meetings  /  Peer Support  /  Documentation  /  Projects


Procedures for
Machine/User
Mapping


Return to IT/SA Services Documentation: Active Directory

Introduction

There has been some discussion about ways to attribute users to machines.
The idea is to determine what machines each of our users operate. It
was decided that this could be facilated via additional logon and
logoff scripts. The scripts themselves are detailed below.

LogonLog.vbs

Set objNetwork = CreateObject("Wscript.Network")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.CommandTimeout=5
objConnection.Open "Driver={SQL Server};Server=IF-SRV-SQL02.AD.UFL.EDU;Database=AD-APPS"          
objConnection.Execute "INSERT INTO UsageLog (Username, Computer, Time, Action) VALUES ('" & objNetwork.ComputerName & "', '" & objNetwork.Username & "', '" & Now() & "', 'Logon')"

LogoffLog.vbs

 
Set objNetwork = CreateObject("Wscript.Network")
Set objConnection = CreateObject("ADODB.Connection")
objConnection.CommandTimeout=5
objConnection.Open "Driver={SQL Server};Server=IF-SRV-SQL02.AD.UFL.EDU;Database=AD-APPS"          
objConnection.Execute "INSERT INTO UsageLog (Username, Computer, Time, Action) VALUES ('" & objNetwork.ComputerName & "', '" & objNetwork.Username & "', '" & Now() & "', 'Logoff')"

Output stored in SQL

1          IF-99SVG41      hughescj           4/21/2006 5:21:06 PM    Logon
2          IF-99SVG41      hughescj           4/21/2006 5:23:08 PM    Logoff
3          IF-99SVG41      hughescj           4/21/2006 5:26:39 PM    Logon
4          IF-99SVG41      hughescj           4/21/2006 5:26:42 PM    Logoff

last edited 25 April 2006 by Steve Lasley