3
votes

I am trying to run a LDAP query against AD to give me all the email addressed for a given group. I tried this but it gives me the email address for the distribution but not for the members.

I tried this (&(objectCategory=group)(Name=My-TEST-Group)) LDAP query with Mail being output but it does not give emails for the members .

I tried member as output but that gives me members CN details with this format CN=Smith\, Johne,OU=Standard Users,OU=SouthWest,OU=Active-Users,DC=NOV,DC=net

1
I tried this but it does not return anything. (&(objectCategory=user)(memberOf=cn=my-Test-group)). Output mail or displayname all emptyGreen Code
hmm. tried this again but no result. it returns blank. (&(objectCategory=user)(memberof=cn=my-test-group,ou=sw-users))Green Code
this wont return anything either. hmm. (&(objectCategory=person)(objectClass=user)(memberof=cn=my-test-group))Green Code

1 Answers

2
votes

I found the problem. The problem is the memberof (at least in my environment) requires full OU.

so 2 steps. First I had to get the full OU for the given group.

(&(objectCategory=group)(cn=dg-fmog-sp-test)) and get distinguishedName

so my final query looks like following and it works.

(&(&(objectCategory=person)(objectClass=user))(memberOf=cn=my-test-group, OU=SW Distribution, OU=Email Servers, OU=Data Mining, OU=US, dc=NOV,dc=net)) and get mail