cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jv
Engaged Sweeper II

I just enabled under server options - Scan Success audit events. We want to have the history of users logon events.

I am new to using reports and we would like to build a report where we can have the history of logon times of our users. How can I create this?

Thanks!
1 ACCEPTED SOLUTION
FixitDave
Champion Sweeper
Looking at another post I was able to get what I wanted with the following code...


Select Distinct Top 1000000 tblADusers.Username,
tblADusers.Userdomain,
Max(tblCPlogoninfo.logontime) As 'last logon'
From tblADusers
Inner Join tblADMembership On tblADMembership.ChildAdObjectID =
tblADusers.ADObjectID
Inner Join tblADGroups On tblADMembership.ParentAdObjectID =
tblADGroups.ADObjectID
Inner Join tblCPlogoninfo On tblCPlogoninfo.Username = tblADusers.Username And
tblCPlogoninfo.Domain = tblADusers.Userdomain
Group By tblADusers.Username,
tblADusers.Userdomain

View solution in original post

5 REPLIES 5
jv
Engaged Sweeper II
Thank you very much for sharing this updated info fixitdave
FixitDave
Champion Sweeper
Looking at another post I was able to get what I wanted with the following code...


Select Distinct Top 1000000 tblADusers.Username,
tblADusers.Userdomain,
Max(tblCPlogoninfo.logontime) As 'last logon'
From tblADusers
Inner Join tblADMembership On tblADMembership.ChildAdObjectID =
tblADusers.ADObjectID
Inner Join tblADGroups On tblADMembership.ParentAdObjectID =
tblADGroups.ADObjectID
Inner Join tblCPlogoninfo On tblCPlogoninfo.Username = tblADusers.Username And
tblCPlogoninfo.Domain = tblADusers.Userdomain
Group By tblADusers.Username,
tblADusers.Userdomain
FixitDave
Champion Sweeper
This is great so thanks for sharing.

I'd like to use this report to see when all users last logged in.

We don't always get notified of leavers so accounts can hang around.

I've been having a play but can't get my head around how to amend the above to only show the latest login event..any Lansweeper/SQL experts out there?
estinson
Engaged Sweeper II
This is a very helpful report for us, thank you for sharing it.
One thing I would like is to restrict this to the last 10 logons per machine, is there any way to make it do that?
jv
Engaged Sweeper II


Lansweeper support was very helpful.

This report will give you all successful logins of users:
Select Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.logontime,
tblAssets.AssetID,
tblAssets.AssetName
From tblAssets
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Order By tblCPlogoninfo.Username,
tblCPlogoninfo.logontime