I am trying to create a report that will show computers that do not contain the user "localadmin". Since there are more than one user on the computer, it shows even those computers on which there is a "localadmin" user. I do not understand how to filter this.
Select Distinct Top 1000000 tsysOS.Image As icon,
tblAssets.AssetID,
tblAssets.AssetName,
tblAssets.Domain,
tblAssets.Username,
tblAssets.Userdomain,
tblAssets.IPAddress
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysOS On tsysOS.OScode = tblAssets.OScode
Inner Join tblUsers On tblAssets.AssetID = tblUsers.AssetID
Inner Join tblOperatingsystem On
tblAssets.AssetID = tblOperatingsystem.AssetID
Where tblAssetCustom.State = 1 And tblUsers.Name != 'Localadmin' And
tblOperatingsystem.ProductType = '1'
Order By tblAssets.Domain,
tblAssets.AssetName