Pages

Wednesday, January 28, 2009

Exchange admin tip: Create a query-based distribution group

Requirements:
  • Windows Active Directory
  • Exchange server 2003 or higher
Do you have distribution groups or lists that you are maintaining constantly? Are they department or organization-based groups? Perhaps you have organized your OU structure within Active Directory according to department or logical business units?

If your answers were "yes" or you are just plain curious...then here is a really handy way to create virtually maintenance-free distribution groups in Exchange. The only thing you would need to do is make sure that your users are located in their proper OU structure in AD so they automatically become members of the group you are creating.

Here's the information from Microsoft:
  1. In Active Directory Users and Computers, in the console tree, right-click the container where you want to create the query-based distribution group, point to New, and then click Query-based Distribution Group.

  2. In Query-based Distribution Group name, type a name for the query-based distribution group, and then click Next.

  3. Under Apply filter to recipients in and below, verify that the parent container shown is the one that you want the query-based distribution group to be run against. If this is not the correct container, click Change to select another container.

    Aa996382.note(en-us,EXCHG.65).gifNote:
    The query returns only recipients in the selected container and its child containers. To get the results that you want, you may have to select a parent container or create multiple queries.
  4. Under Filter, select one of the following options:

    • To filter the query based on a set of predefined criteria, click Include in this query-based distribution group, and then select from the following criteria:
      - Users with Exchange mailboxes
      - Users with external e-mail addresses
      - Groups that are mail-enabled
      - Contacts with external e-mail addresses
      - Public folders that are mail-enabled
    • To create your own criteria for the query, click Customize filter, and then click Customize.
  5. Click Next to see a summary of the query-based distribution group that you are about to create.

  6. Click Finish to create the query-based distribution group.

    The new query-based distribution group appears under the container that you selected in Step 3.

So, I've created an LDAP filter/query that picks up users that are located in an OU (in my case, an OU that denotes a physical location, "State Street").

Here is the query that I've created:

(&(!cn=SystemMailbox{*})(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) )))

Don't worry, you create these queries on the fly and isn't as complex as it looks above.

But...you can create compound filters if you want to get really crazy.

Excluding users from a query:

I created a filter that excluded our physicians here in town (the last part of the query excludes an account called helpdesk from the distribution list):

(&(!cn=SystemMailbox{*})(&(&(&(|(&(objectCategory=person)(objectSid=*)(!samAccountType:1.2.840.113556.1.4.804:=3))(&(objectCategory=person)(!objectSid=*))(&(objectCategory=group)(groupType:1.2.840.113556.1.4.804:=14)))(& (mailnickname=*) (| (&(objectCategory=person)(objectClass=user)(|(homeMDB=*)(msExchHomeServerName=*))) )))(objectCategory=user)(!description=Physician*)(!samAccountName=helpdesk))))

So, the benefit? First, each distribution list gets their own SMTP email address - and, as long as my users appear in those OU's, my distribution lists are always up to date!


No comments:

Search CFJ