cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TwistedMexi
Engaged Sweeper
I've been trying to get a query setup that will return a list of all users, their latest logon date and the latest PC they used.

How would I set this up?
1 ACCEPTED SOLUTION
Hemoco
Lansweeper Alumni
Please use the query below for Lansweeper 5.0.
Select Top 1000000 SubQuery.Username,
SubQuery.Domain As Userdomain,
SubQuery.LastLogon,
tblAssets.AssetName,
tblAssets.Domain
From tblCPlogoninfo
Inner Join (Select Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
Max(tblCPlogoninfo.logontime) As LastLogon
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) SubQuery On tblCPlogoninfo.Username =
SubQuery.Username And tblCPlogoninfo.Domain = SubQuery.Domain And
tblCPlogoninfo.logontime = SubQuery.LastLogon
Inner Join tblAssets On tblAssets.AssetID = tblCPlogoninfo.AssetID

View solution in original post

7 REPLIES 7
Culejoe
Engaged Sweeper
Awesome thanks!

I'm not to familiar in report building and my next question is... Can the above be edited to run for a single user? Such as if you wanted to run a report to see when someone last used an account called lets say SQL_Admin.

Thanks!
Hemoco
Lansweeper Alumni
Culejoe wrote:
Awesome thanks!

I'm not to familiar in report building and my next question is... Can the above be edited to run for a single user? Such as if you wanted to run a report to see when someone last used an account called lets say SQL_Admin.

Thanks!

You can view the logons of this person on the user detail page.
Hemoco
Lansweeper Alumni
Please use the query below for Lansweeper 5.0.
Select Top 1000000 SubQuery.Username,
SubQuery.Domain As Userdomain,
SubQuery.LastLogon,
tblAssets.AssetName,
tblAssets.Domain
From tblCPlogoninfo
Inner Join (Select Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
Max(tblCPlogoninfo.logontime) As LastLogon
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) SubQuery On tblCPlogoninfo.Username =
SubQuery.Username And tblCPlogoninfo.Domain = SubQuery.Domain And
tblCPlogoninfo.logontime = SubQuery.LastLogon
Inner Join tblAssets On tblAssets.AssetID = tblCPlogoninfo.AssetID
spamking
Engaged Sweeper III
Very good idea for a report . . .
steve_huon
Engaged Sweeper
Same here. Just like the widget on the dashboard it would be nice to have it in a report. Is this possible?

Regards,

Steve
Culejoe
Engaged Sweeper
Im looking for a report like this too. Currently on Lansweeper 5.0.
Hemoco
Lansweeper Alumni
Which Lansweeper version are you using? 4.2 or 5.0?