Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
danielm
Champion Sweeper II
I'd like to integrate a simple lookup on a website that allows people to find the name of a computer belonging to someone. So essentially the same info shown on the Screen that is shown when a person/account is viewed in lansweeper.

How can I generate an sql query or report to show the following detals?

username
Display Name
along with the computer name and last logon time.

1 ACCEPTED SOLUTION
Hemoco
Lansweeper Alumni
Hi,

You can use the report down here:
Select Top 1000000 tblADusers.Username As Username1,
tblADusers.Userdomain As Userdomain1,
tblADusers.Displayname As Displayname1,
tblAssets.AssetID As AssetID1,
tblAssets.AssetName As AssetName1,
Max(tblCPlogoninfo.logontime) As 'last logon time'
From tblAssets
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Inner Join tblADusers On tblADusers.Username = tblCPlogoninfo.Username And
tblADusers.Userdomain = tblCPlogoninfo.Domain
Group By tblADusers.Username,
tblADusers.Userdomain,
tblADusers.Displayname,
tblAssets.AssetID,
tblAssets.AssetName
Order By Username1,
Userdomain1

To use the report above, do the following:
• Open the report builder under Reports/Create New Report.
• Paste the SQL code we provided at the bottom of the page.
• Left-click somewhere in the upper section of the page so the code applies.
• Give the report a Title and hit the Save & Run button to save it. Export options are listed on the left.

View solution in original post

2 REPLIES 2
danielm
Champion Sweeper II
Thank you. good starting point.
Hemoco
Lansweeper Alumni
Hi,

You can use the report down here:
Select Top 1000000 tblADusers.Username As Username1,
tblADusers.Userdomain As Userdomain1,
tblADusers.Displayname As Displayname1,
tblAssets.AssetID As AssetID1,
tblAssets.AssetName As AssetName1,
Max(tblCPlogoninfo.logontime) As 'last logon time'
From tblAssets
Inner Join tblCPlogoninfo On tblAssets.AssetID = tblCPlogoninfo.AssetID
Inner Join tblADusers On tblADusers.Username = tblCPlogoninfo.Username And
tblADusers.Userdomain = tblCPlogoninfo.Domain
Group By tblADusers.Username,
tblADusers.Userdomain,
tblADusers.Displayname,
tblAssets.AssetID,
tblAssets.AssetName
Order By Username1,
Userdomain1

To use the report above, do the following:
• Open the report builder under Reports/Create New Report.
• Paste the SQL code we provided at the bottom of the page.
• Left-click somewhere in the upper section of the page so the code applies.
• Give the report a Title and hit the Save & Run button to save it. Export options are listed on the left.

Reports & Analytics

Ask about reports you're interested in and share reports you've created. Subscribe to receive daily updates of reports shared in the Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now