Search code examples
ldapldap-query

LDAP: Filter users belonging to a group across multiple OU's


I've the following structure in AD

DC=comp,DC=com
    OU=city1
       OU=group
       OU=users
         user1
         user2
    OU=city2
       OU=group
       OU=users
         user3
         user4

I am trying to filter and retrieve user 1-4 in a single query. I've tried the filter (dn=OU=users,ou=*,DC=comp,DC=com) but it returned empty. What's the best way to filter in this condition?


Solution

  • Unfortunately, Microsoft Active Directory does not support extensible match filter for this condition.

    If these are the only users, setting a base at "DC=comp,DC=com" will return the users.