→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
xchrisx
Engaged Sweeper
I am looking for a report that will tell me the last 30 users who logged into machine X.
1 ACCEPTED SOLUTION
Susan_A
Lansweeper Alumni
A sample query can be seen below. You'll need to replace the NetBIOS computer name with your own and run the report by following these instructions. If you are interested in building or modifying reports, we would recommend:
  • Reviewing some SQL tutorials, as the Lansweeper report builder is a standard SQL editor. If you know SQL, you know how to build Lansweeper reports as well. This seems like a good tutorial.
  • Updating to Lansweeper 5.3, if you haven't already. Lansweeper 5.3 includes a database dictionary, which is linked at the top of the report builder. The dictionary explains in great detail what each table and field stores.

Select Distinct Top 30 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.IPAddress,
tblAssets.Firstseen,
tblAssets.Lastseen,
SubQuery1.Username,
SubQuery1.Domain As Userdomain
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join (Select Top 1000000 tblCPlogoninfo.AssetID,
tblCPlogoninfo.Domain,
tblCPlogoninfo.Username
From tblCPlogoninfo
Order By tblCPlogoninfo.logontime Desc) SubQuery1 On SubQuery1.AssetID =
tblAssets.AssetID
Where tblAssets.AssetName = 'lan-001' And tblAssetCustom.State = 1

View solution in original post

1 REPLY 1
Susan_A
Lansweeper Alumni
A sample query can be seen below. You'll need to replace the NetBIOS computer name with your own and run the report by following these instructions. If you are interested in building or modifying reports, we would recommend:
  • Reviewing some SQL tutorials, as the Lansweeper report builder is a standard SQL editor. If you know SQL, you know how to build Lansweeper reports as well. This seems like a good tutorial.
  • Updating to Lansweeper 5.3, if you haven't already. Lansweeper 5.3 includes a database dictionary, which is linked at the top of the report builder. The dictionary explains in great detail what each table and field stores.

Select Distinct Top 30 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.IPAddress,
tblAssets.Firstseen,
tblAssets.Lastseen,
SubQuery1.Username,
SubQuery1.Domain As Userdomain
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join (Select Top 1000000 tblCPlogoninfo.AssetID,
tblCPlogoninfo.Domain,
tblCPlogoninfo.Username
From tblCPlogoninfo
Order By tblCPlogoninfo.logontime Desc) SubQuery1 On SubQuery1.AssetID =
tblAssets.AssetID
Where tblAssets.AssetName = 'lan-001' And tblAssetCustom.State = 1