Active Directory (LDAP) query/filter to retrieve Exchange distribution lists

sorin picture sorin · Sep 3, 2012 · Viewed 24.4k times · Source

I am looking for an LDAP query that would retrieve Exchange distribution lists.

If I am doing the simple (objectClass=Group) I will get too many groups, most of them not useful.

Answer

BartekB picture BartekB · Sep 3, 2012

I would use groupType attribute to identify distribution lists. Here you can find info how to tell the difference between security/ distribution.

And filter can look like that:

(&(objectClass=group)(!(groupType:1.2.840.113556.1.4.803:=2147483648)))

EDIT alternatively, you may want to check for groups that has e-mail addresses in exchange, smth like:

(&(objectClass=group)(proxyAddresses=*))