[SOLVED] Listing Distribution List Members
We have been using the distribution lists feature via the Admin UI for a while now, and we keep finding more and more uses for them. The only problem that we have come across (caused by us) is that we need to periodically audit the members of each distribution list. We do this to make sure that all required users are on each list, and that no one is on a list that they shouldn't be.
I did not see anything already available that did this so I put together a real basic LDAP query to accomplish this task. I figured that if I needed to do this someone else would also, so here is the basic query to list the members of all distribution lists:
If you only want to list a single distribution list you can run the query as follows:
ldapsearch -x -v -H 'ldap://localhost/' -b 'ou=people,dc=mydomain,dc=com' "objectClass=zimbraDistributionList" mail zimbraMailForwardingAddress
These commands need to be run as the zimbra user. Also, make sure you replace these strings:
ldapsearch -x -v -H 'ldap://localhost/' -b 'uid=distributionlistname,ou=people,dc=mydomain,dc=com' "objectClass=zimbraDistributionList" mail zimbraMailForwardingAddress
mydomain - should be your domain name
distributionlistname - should be the name of the distribution list you are trying to list
Hopefully, someone else will get some use out of this.