cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
tuc
Engaged Sweeper II
Hello

How I can create a report which displays "all assets where User Relations is empty"?
I found quite the opposite in thread "Asset user relationship history report"...
1 ACCEPTED SOLUTION
Jeremy_D
Champion Sweeper
I included a sample report below that lists any active assets without a "used by" user relation. Instructions for adding this report to your Lansweeper installation can be found here.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Firstseen,
tblAssets.Lastseen,
tblAssets.Lasttried
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tblAssets.AssetID Not In (Select Top 1000000 tblAssetUserRelations.AssetID
From tblAssetUserRelations Inner Join tsysAssetRelationTypes
On tsysAssetRelationTypes.RelationTypeID = tblAssetUserRelations.Type
Where tsysAssetRelationTypes.Name = 'used by') And tblAssetCustom.State = 1
Order By tblAssets.IPNumeric,
tblAssets.AssetName

View solution in original post

2 REPLIES 2
tuc
Engaged Sweeper II
Many thanks Jeremy!!
Jeremy_D
Champion Sweeper
I included a sample report below that lists any active assets without a "used by" user relation. Instructions for adding this report to your Lansweeper installation can be found here.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Firstseen,
tblAssets.Lastseen,
tblAssets.Lasttried
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tblAssets.AssetID Not In (Select Top 1000000 tblAssetUserRelations.AssetID
From tblAssetUserRelations Inner Join tsysAssetRelationTypes
On tsysAssetRelationTypes.RelationTypeID = tblAssetUserRelations.Type
Where tsysAssetRelationTypes.Name = 'used by') And tblAssetCustom.State = 1
Order By tblAssets.IPNumeric,
tblAssets.AssetName