cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RayPamps23
Engaged Sweeper II
Is there a way I can change the representation of the result of the OU(Canonical Name of object) here in Lansweeper?
eg.
instead of "OU=Test, OU=Prod Users, OU, OU=Testing OU, DC=mydomain, DC=COM"

I want to show this kind of format so I can read the result easily.
mydomain.com/Testing OU/Prod Users/Test

Hope there is a way 🙂

------------------------------------------------
Select Top 1000000 tblADusers.Username,
tblADusers.Name,
tblADusers.OU,
tblADusers.whenCreated,
tblADusers.IsEnabled,
tblADusers.LastLogon
From tblADusers
Left Join (Select Top 1000000 tblCPlogoninfo.Username,
tblCPlogoninfo.Domain As Userdomain,
Max(tblCPlogoninfo.logontime) As Lastlogon
From tblCPlogoninfo
Group By tblCPlogoninfo.Username,
tblCPlogoninfo.Domain) SubQuery1 On SubQuery1.Username =
tblADusers.Username And SubQuery1.Userdomain = tblADusers.Userdomain
Where tblADusers.OU Not Like '%Disabled%' And tblADusers.LastLogon < GetDate() - 90
Order By tblADusers.LastLogon
1 REPLY 1
FrankSc
Lansweeper Tech Support
Lansweeper Tech Support
Hello,

The OU information you wish to transform is now shown as tblADusers.OU in your SELECT section as a string. SQL holds a set of string functions that could help you in getting the result you require.
By using SUBSTRING() for example, you could take parts from the string you require and then by using the CONCAT() function you can then concatenate all the sections in the new order you would like to see them.

More information on the SQL string functions can be found in the SQL documentation:
https://docs.microsoft.com/en-us/sql/t-sql/functions/substring-transact-sql?view=sql-server-ver15