‎08-04-2016 04:11 PM
‎08-12-2016 09:31 PM
‎08-05-2016 08:33 PM
Select Top 10000 tblADusers.Displayname,
tblADusers.Userdomain,
tblADusers.Username,
(Select Top 1 tblCPlogoninfo.logontime From tblCPlogoninfo
Where tblCPlogoninfo.Domain = tblADusers.Userdomain And
tblCPlogoninfo.Username = tblADusers.Username Order By
tblCPlogoninfo.logontime Desc) As LastLogonTime
From tblADusers
Order By tblADusers.Displayname
‎08-08-2016 09:26 PM
MikeMc wrote:
The query I provided is not the most efficient in terms of processing, so it is likely taking a long time due to your environment having a much larger user base and/or logon history. You are welcome to try this simpler query:Select Top 10000 tblADusers.Displayname,
tblADusers.Userdomain,
tblADusers.Username,
(Select Top 1 tblCPlogoninfo.logontime From tblCPlogoninfo
Where tblCPlogoninfo.Domain = tblADusers.Userdomain And
tblCPlogoninfo.Username = tblADusers.Username Order By
tblCPlogoninfo.logontime Desc) As LastLogonTime
From tblADusers
Order By tblADusers.Displayname
‎08-04-2016 11:30 PM
‎08-04-2016 11:46 PM
MikeMc wrote:
- Open your local Lansweeper website.
- Go to reports, and then select New Report.
- Name your report.
- Copy and paste the code in my previous post in the bottom-most window of the page.
- Select Save & Run.
‎08-04-2016 11:16 PM
Select Top 1000000 tblADusers.Displayname,
tblADusers.Userdomain,
tblADusers.Username,
T2.AssetID,
T2.AssetName,
T1.LastLogonTime
From tblADusers
Left Outer Join (Select tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
Max(tblCPlogoninfo.logontime) As LastLogonTime
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) T1 On T1.Domain = tblADusers.Userdomain And
T1.Username = tblADusers.Username
Left Outer Join (Select tblAssets.AssetID,
tblAssets.AssetName,
tblCPlogoninfo.Domain,
tblCPlogoninfo.Username,
tblCPlogoninfo.logontime
From tblAssets
Inner Join tblCPlogoninfo On tblCPlogoninfo.AssetID = tblAssets.AssetID) T2
On T2.Domain = tblADusers.Userdomain And T2.Username = tblADusers.Username
And T2.logontime = T1.LastLogonTime
Order By tblADusers.Displayname
‎08-04-2016 11:18 PM
MikeMc wrote:
Perhaps this will be a start but this is the report we use to list all our domain users and the last asset they used with logon time.Select Top 1000000 tblADusers.Displayname,
tblADusers.Userdomain,
tblADusers.Username,
T2.AssetID,
T2.AssetName,
T1.LastLogonTime
From tblADusers
Left Outer Join (Select tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
Max(tblCPlogoninfo.logontime) As LastLogonTime
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) T1 On T1.Domain = tblADusers.Userdomain And
T1.Username = tblADusers.Username
Left Outer Join (Select tblAssets.AssetID,
tblAssets.AssetName,
tblCPlogoninfo.Domain,
tblCPlogoninfo.Username,
tblCPlogoninfo.logontime
From tblAssets
Inner Join tblCPlogoninfo On tblCPlogoninfo.AssetID = tblAssets.AssetID) T2
On T2.Domain = tblADusers.Userdomain And T2.Username = tblADusers.Username
And T2.logontime = T1.LastLogonTime
Order By tblADusers.Displayname
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now