3

Is it possible to search active directory for a group like this: - Give me all groups that contain the name sample?

In SQL I would write

SELECT * FROM GROUP WHERE NAME LIKE %sample%

I found on msdn some hints for expressions =, <= but not for a like. http://msdn.microsoft.com/en-us/library/system.directoryservices.directorysearcher.filter.aspx

Thanks for any hints.

Santosh Panda
  • 7,235
  • 8
  • 43
  • 56
yonexbat
  • 2,902
  • 2
  • 32
  • 43

2 Answers2

3

Star acts like a wildcard in queries, so that filters like "a*" or "*a" should work.

Wiktor Zychla
  • 47,367
  • 6
  • 74
  • 106
2

If you are just looking to search for the name of the group, the link at the bottom of the page you linked tells you what to do but it does not take you directly to the page

For more information about the LDAP search string format, see "Search Filter Syntax" (I added the correct link)

Use a query like (&(objectclass=group)(cn=*sample*)) will be what you are looking for.

If you are searching if a user is a member of a group, not just a list of all groups that match a pattern, You need to use MemberOf and wildcards do not work on a MemberOf search

Community
  • 1
  • 1
Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431