SimpleGuy
SimpleGuy

Reputation: 2894

How to get all groups of members who distinguishedName begins with something

My requirement is to get all the groups of users whose distinguishedName begins with say Auser*.

So, I created a filter in Apache Directory Studio

(&
    (objectClass=group)
    (member=CN=Auser*)
)

However, to my surprise, this does not return any results. If I change this to a particular user's distinguishedName, I am able to get results

(&
    (objectClass=group)
    (member=CN=AUser10,OU=Mygrp,DC=domain,DC=com)
)

Am I missing something ?

Upvotes: 0

Views: 6429

Answers (2)

marabu
marabu

Reputation: 1196

member has Distinguished-Name-Syntax, and given it's Active Directory you are trying to search, you can't have substring matching as in a normal Directory-String attribute like cn.

Why don't you just reverse your search strategy? Do a subtree search on your domain with filter (&(objectClass=user)(cn=userprefix*)) retrieving attribute memberOf, export to CSV, remove duplicates, done.

Upvotes: 1

Dindar
Dindar

Reputation: 3235

Please try this one :

(&
    (objectCategory=group)
    (name=Auser*)
)

distinguished name is long name containing full path + name. like : CN=Username,OU=internalFolder,OU=parentFolder,DC=domainComponentName,DC=com

For filtering by name just search on the name or other attributes you want like givenName

Upvotes: 0

Related Questions