Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
initram
Engaged Sweeper II
We're trying to figure out a way to identify employees who login to a computer that they were not assigned to so that we can make sure that our inventory is up to date.

Is there a way to create a report to show if the last logon doesn't match the account that was manually associated to an AD user account? The feature I am referring to is found under "Edit User" -> "Asset Relations".

If that's not possible, is there a way to create a report that will show when the last logon user was different from the previous user?

I'm aware that we can restrict a user from only using a specific computer through AD. But we would rather not limit the employees ability to use a different computer if the need arises.

Thank you.
1 REPLY 1
initram
Engaged Sweeper II
For anyone interested, I had also opened a ticket with Lansweeper and they provided me with the following report code. So far it's working just as I had intended.




Select Top (1000000) tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
Case
When tblAssets.UserName Is Not Null And tblAssets.username != '' Then
tblAssets.userdomain + '\' + tblAssets.Username
Else ''
End As hyperlink_name_Lastuser,
Case
When tblAssetUserRelations.Userdomain Is Null Then ''
Else '/user.aspx?username=' + tblAssets.Username + '&userdomain=' +
tblAssets.Userdomain
End As hyperlink_Lastuser,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tsysIPLocations.IPLocation,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
Coalesce(tsysOS.OSname, tblLinuxSystem.OSRelease, tblMacOSInfo.KernelVersion)
As OS,
tblAssets.SP,
tblAssets.Firstseen As [Created at],
tblAssets.Lastseen As [Last successful scan],
tblAssets.Lasttried As [Last scan attempt],
tsysAssetRelationTypes.RelationTypeIcon10 As Icon3,
tsysAssetRelationTypes.Name As RelationType,
tblAssetUserRelations.Comments As RelationComments,
tblAssetUserRelations.StartDate As RelationStartDate,
tblAssetUserRelations.EndDate As RelationEndDate,
Case
When tblAssetUserRelations.Userdomain Is Null Then ''
When tblADusers.Displayname Is Null Or
tblADusers.Displayname = '' Then tblAssetUserRelations.Userdomain + '\' +
tblAssetUserRelations.Username
Else tblADusers.Displayname
End As hyperlink_name_RelationUser,
Case
When tblAssetUserRelations.Userdomain Is Null Then ''
Else '/user.aspx?username=' + tblAssetUserRelations.Username +
'&userdomain=' + tblAssetUserRelations.Userdomain
End As hyperlink_RelationUser,
Replace(tblAssetUserRelations.Ou, ',', ', ') As hyperlink_name_Ou,
Case
When tblAssetUserRelations.Ou Is Null Then ''
Else '/Report/report.aspx?det=web50findusersbyOU&title=' +
Replace(tblAssetUserRelations.Ou, '&', '%26') + '&@OU=' +
Replace(tblAssetUserRelations.Ou, '&', '%26')
End As hyperlink_Ou,
tblADGroups.Name As [hyperlink_name_AD Group],
Case
When tblAssetUserRelations.AdObjectId Is Null Then ''
Else '/Report/report.aspx?det=web50usersbyadgroup&title=' + tblADGroups.Name
+ '&@id=' + Cast(tblAssetUserRelations.AdObjectId As nvarchar(10))
End As [hyperlink_AD Group],
Case
When tblAssetUserRelations.EndDate < GetDate() Then '#dddddd'
Else '#ffffff'
End As backgroundcolor
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblAssetUserRelations On
tblAssets.AssetID = tblAssetUserRelations.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State
Inner Join tsysIPLocations On tsysIPLocations.LocationID =
tblAssets.LocationID
Left Outer Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tsysAssetRelationTypes On tblAssetUserRelations.Type =
tsysAssetRelationTypes.RelationTypeID
Left Outer Join tblLinuxSystem On tblAssets.AssetID = tblLinuxSystem.AssetID
Left Outer Join tblMacOSInfo On tblAssets.AssetID = tblMacOSInfo.AssetID
Left Outer Join tblADusers On
tblADusers.Userdomain = tblAssetUserRelations.Userdomain And
tblADusers.Username = tblAssetUserRelations.Username
Left Outer Join tblADGroups On tblADGroups.ADObjectID =
tblAssetUserRelations.AdObjectId
Where tblState.Statename = 'Active' And (Lower(tblADusers.Userdomain) !=
Lower(tblAssets.Userdomain) Or Lower(tblADusers.Username) !=
Lower(tblAssets.Username))
Order By Case
When tblAssetUserRelations.EndDate Is Null Then 1
Else 0
End Desc,
RelationEndDate Desc,
RelationStartDate Desc,
tblAssets.AssetName,
tblAssets.Domain

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