Search code examples
active-directoryldapldap-query

LDAP Get Groups Beginning With


I have a situation whereby Active Directory groups are prefixed with a unique code. For instance

  1. 12345 Users
  2. 12345 Admins
  3. 67890 Users
  4. 67890 Admins

I'm currently using LDAP to get all groups but I would like to restrict this to only those prefixed with the id.

Effectively get groups beginning with 12345.

How can I achieve this with LDAP?


Solution

  • Using LDAP a filter like:

    &((ObjectClass=Group)(cn=12345*))
    

    Will retrieve groups beginning with 12345. -jim