‎03-05-2020 05:08 PM
‎09-17-2021 09:23 PM
‎03-10-2020 12:25 PM
‎03-09-2020 07:21 PM
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join (SELECT
tblCPlogoninfo.AssetID,
Count(*) AS LogonCount
FROM
tblCPlogoninfo
Inner Join tblADusers On tblCPlogoninfo.Domain = tblADusers.Userdomain And tblCPlogoninfo.Username = tblADusers.Username
WHERE
tblCPlogoninfo.logontime >= GetDate() - 90
AND tblADUsers.OU LIKE '%your_ou_text%'
GROUP BY
tblCPlogoninfo.AssetID
) AS OULogons ON OULogons.AssetID = tblAssets.AssetID
Where
tblAssetCustom.State = 1
Select Top 1000000
tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join (SELECT Distinct
tblCPlogoninfo.AssetID
FROM
tblCPlogoninfo
Inner Join tblADusers On tblCPlogoninfo.Domain = tblADusers.Userdomain And tblCPlogoninfo.Username = tblADusers.Username
WHERE
tblCPlogoninfo.logontime >= GetDate() - 90
AND tblADUsers.OU LIKE '%your_ou_text%'
) AS OULogons ON OULogons.AssetID = tblAssets.AssetID
Where
tblAssetCustom.State = 1
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now