Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tracking a workstation's most 'popular' user?

Status
Not open for further replies.

Borf

Programmer
Sep 26, 2001
3
GB
Hi all.

I am currently looking for a way to monitor the usage of Windows PCs (mostly XP, some NT) i.e. who logs in and uses them the most.

I thought at first that a domain controller would hold information for a user such as WHICH workstations he/she logged onto (and when).

The only other solution was to look at the event or application log and 'count' the most frequent user name.

All this data is to be automatically harvested from hundreds of workstations across tens of domains, into a DB so we can generally link Users to Workstations.


Would anyone have a more graceful solution finding out the most frequent user of a PC?

Many thanks for your ideas.
 
We only use this on a single site with 400 PC's and about 1000 users so it might not be suitable for your environment, it requires JET to be installed on the client this will already be installed if Office is on the system. It logs time,date,user and computer to an Access Db.

Code:
On Error Resume Next

Dim adoCn
Dim adoRs
Dim network
Dim user
Dim compname
Dim strSQLInsert


Set network = CreateObject("Wscript.Network")
user = network.username
compname = network.computername

Set adoCn = CreateObject("ADODB.Connection")

adoCn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=\\server\logs$\its\users.mdb" 'CHANGE THIS BIT

'Check the connection opened ok           
If Err.Number <> 0 Then           
	Call ErrHandler
End If


strSQLInsert = "INSERT INTO [Log On] ([date], [time], [user], compname) " & _  
	"VALUES ('" & Date & "', '" & Time & "', '" & user & "', '" & compname & "')"

adoCn.Execute strSQLInsert, , 8

'Check the data was inserted OK
If Err.Number <> 0 Then           
	Call ErrHandler
End If

adoCn.Close

Set adoCn = Nothing
Set network = Nothing



Sub ErrHandler()
Dim fso, f

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.OpenTextFile("\\server\logs$\" & LogError & ".txt" , ForAppending, True)

f.WriteLine Date & ", " & Time & ", " & user & ", " & compname & ", " & Chr(34) & Err.Description & Chr(34)
f.Close

Set fso = nothing

Err.Clear

End Sub
 
I posted to the other thread, I stumbled accross (they were suggested to us by Foresster) this sounds like it is right up thier ally...I was looking for someone who may have used thier software in the past (i need something for client side web app response time for internal users) anyway, it looks like good stuff, I was just hoping someone else may have used it in the past?

thanks

bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top