Get part of DistinguishedName

Hi,
i am trying to create an automatic group based on the computer’s OU.
our AD structure is a single domain, where servers are all in the “servers” OU and under the Servers OU we have an OU per group (DBA, SYS, EMS etc.)
i want all computers in DBA OU will be a part of the automatic group “DBA”, etc.
when i run in QnA the following query:
q: distinguished name of local computer of active directory
i get the correct result:
A: CN=SERVERNAME,OU=SYS,OU=Servers,OU=DC1,OU=Country,OU=Region,DC=DOAMIN,DC=DOMAIN,DC=com

i want to get the “OU=SYS” part and set it as a computer property, and then create the automatic group based on that property.

how can i get the “OU=SYS” part (better just the “SYS” part)?

Thanks,
Shlomi

Create your Automatic Group, and use the following Relevance to determine membership in the group …

Exists (distinguished name of local computer of active directory) AND ((distinguished name of local computer of active directory) contains "OU=SYS,OU=Servers,OU=DC1,")

I included the OU=Servers,OU=DC1, portion to ensure that you were referencing the correct OU since there is no technical reason that there can’t be another OU with the name “SYS” or that has “SYS” as part of it’s name.

1 Like

that worked wonderfully, thanks!

following that issue:
how can i extract the characters after the first “OU=” and before the following “,” and set it as a property?
the idea is to have a property that i can use identify to which OU each computer belongs to.
for example:
from “OU=SYS,OU=Servers,OU=DC1” i want to add a property called “OU Name” with a value of “SYS”

Thanks!

There is likely a simpler way to do this but try the following …

tuple string item 1 of (concatenation ", " of (substrings separated by ",OU=" of (distinguished name of local computer of active directory)))

always had trouble with tuples, thanks Tim, it worked!