This week I was faced with finding a way to clean up a few of the query based distribution lists that were created by a previous consultant group. The major problem with the queries is that they didn't take into account the dynamics of organizational turn over. The query based DL's were configured to send to every object that had an email address in that exchange store for each OU. This meant that NDR's (Non Deliverable Reciepts) were being sent for every disabled account in those OU's.
Without addressing the business rules of user account retention, I adjusted the LDAP filters to check the disabled flag on the userAccountControl. Now the queries will only send email to active accounts.
- Global All Users Distribution List
(&(&(&(&(mailnickname=*)(|(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2)(|(homeMDB=*)(msExchHomeServerName=*))))))))