→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

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

Hi,

I am trying to write a SQL report in Lansweeper that shows all users that have logged in today,

Below is what I have so far but can't find how to specify LoginTime. I need something like

LastLogonTime = between TodaysDate() AND TodaysDate()

Select Top 1000000 tblADusers.Displayname,
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
Where T1.LastLogonTime = 'between'
Order By tblADusers.Displayname

0 REPLIES 0