
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2017 05:10 PM
Dear All,
I would like to create a report which displays the amount of laptop user was logged on as the last user. For example there will be plenty of machines where the Administrator account was used as the last logged on user.
I would like to display it in 3 columns - Username, Amount, AssetName(hostname of a laptop). Only the users who were logged-on on more that 1 laptop should be displayed.
The end result should look similar to this one:

Below is what I've already accomplished to create but unfortunately I can't get CTE to work in the right way.
Any help will be highly appreciated!
I would like to create a report which displays the amount of laptop user was logged on as the last user. For example there will be plenty of machines where the Administrator account was used as the last logged on user.
I would like to display it in 3 columns - Username, Amount, AssetName(hostname of a laptop). Only the users who were logged-on on more that 1 laptop should be displayed.
The end result should look similar to this one:

Below is what I've already accomplished to create but unfortunately I can't get CTE to work in the right way.
With LaptopsPerUser (UsernameL, Total) As (
Select Top 1000000 tblAssets.Username,
Count(tblAssets.Username) As total
From tblAssets
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblUsers On tblAssets.AssetID = tblUsers.AssetID
Where tblAssets.AssetName Like '%-lt-%' And tblAssets.AssetName Like '%-lt-%'
And tsysAssetTypes.AssetTypename Like '%windows%'
Group By tblAssets.Username
),
OtherData (AssetName) As (
Select Top 1000000 tblAssets.AssetName, tblAssets.Username
From tblAssets
Where tblAssets.AssetName Like '%-lt-%' And tblAssets.AssetName Like '%-lt-%'
And tsysAssetTypes.AssetTypename Like '%windows%'
)
Select * from LaptopsPerUser
Union
Select * from OtherData
Any help will be highly appreciated!
Solved! Go to Solution.
Labels:
- Labels:
-
Report Center
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 05:12 PM
Instructions for adding this report to your Lansweeper installation can be found here. If you are interested in building or modifying reports, we do 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.
- Making use of our database dictionary, which explains in great detail what each database table and field stores. More information on the dictionary can be found here.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
UserCount.Total As UserLastLogonCount,
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 tblState On tblState.State = tblAssetCustom.State
Inner Join (Select Top 1000000 tblAssets.Username,
Count(tblAssets.Username) As Total
From tblAssets
Inner Join tblPortableBattery
On tblAssets.AssetID = tblPortableBattery.AssetID
Group By tblAssets.Username
Having (tblAssets.Username != '') Or
(tblAssets.Username Is Not Null)) As UserCount On tblAssets.Username =
UserCount.Username
Inner Join tblPortableBattery
On tblAssets.AssetID = tblPortableBattery.AssetID
Where UserCount.Total > 1 And tblState.Statename = 'Active'
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2017 05:12 PM
Instructions for adding this report to your Lansweeper installation can be found here. If you are interested in building or modifying reports, we do 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.
- Making use of our database dictionary, which explains in great detail what each database table and field stores. More information on the dictionary can be found here.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
UserCount.Total As UserLastLogonCount,
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 tblState On tblState.State = tblAssetCustom.State
Inner Join (Select Top 1000000 tblAssets.Username,
Count(tblAssets.Username) As Total
From tblAssets
Inner Join tblPortableBattery
On tblAssets.AssetID = tblPortableBattery.AssetID
Group By tblAssets.Username
Having (tblAssets.Username != '') Or
(tblAssets.Username Is Not Null)) As UserCount On tblAssets.Username =
UserCount.Username
Inner Join tblPortableBattery
On tblAssets.AssetID = tblPortableBattery.AssetID
Where UserCount.Total > 1 And tblState.Statename = 'Active'

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2017 11:50 AM
Bump
