→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎11-01-2019 05:40 PM
Select Distinct Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Username,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblCPlogoninfo.logontime
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join (Select tblCPlogoninfo.AssetID,
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
Max(tblCPlogoninfo.logontime) As LastLogonTime
From tblCPlogoninfo
Group By tblCPlogoninfo.AssetID,
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) T1 On T1.AssetID = tblAssets.AssetID
Where tblCPlogoninfo.logontime Is Not Null And tblCPlogoninfo.logontime <
GetDate() - 30 And tblAssetCustom.State = 1 And
tblADComputers.OU Like '%citrix%'
‎11-26-2019 11:11 AM
‎11-25-2019 08:34 PM
GMFDE wrote:
I have a report that lists the systems that have not logged on in the last 30 days. I need to find a way to limit this to show just the last log on event. Below is what I have so far. Any help would be appreciated.Select Distinct Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Username,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblCPlogoninfo.logontime
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Inner Join (Select tblCPlogoninfo.AssetID,
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain,
Max(tblCPlogoninfo.logontime) As LastLogonTime
From tblCPlogoninfo
Group By tblCPlogoninfo.AssetID,
tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) T1 On T1.AssetID = tblAssets.AssetID
Where tblCPlogoninfo.logontime Is Not Null And tblCPlogoninfo.logontime <
GetDate() - 30 And tblAssetCustom.State = 1 And
tblADComputers.OU Like '%citrix%'
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now