AD users are stored in
tblADusers. You need to add this table to your report and manually join it (drag and drop
tblAssets.Username and
tblAsssets.Userdomain to their corresponding fields in
tblADusers). Now you are able to select
tblADusers.OU. We recommend that you have a look at the Database Dictionary as this helps you searching for the location of specific information in the Lansweeper database.
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tblAssets.IPAddress,
tblAssets.Lastseen,
tblAssets.Lasttried,
tblADComputers.OU,
tblAssets.Username,
tblADusers.OU As [User OU]
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Inner Join tblADComputers On tblAssets.AssetID = tblADComputers.AssetID
Left Join tblADusers On tblADusers.Username = tblAssets.Username And
tblADusers.Userdomain = tblAssets.Userdomain
Where tblADComputers.OU = 'CN=Computers,DC=EG01,DC=Etisalat,DC=net' And
tblAssetCustom.State = 1