Recipe5.13.Creating Query-Based Distribution Groups


Recipe 5.13. Creating Query-Based Distribution Groups

Problem

You want to create a mail-enabled distribution group that automatically updates its membership based on rules you specify.

Solution

Using a graphical user interface

  1. Log on to any machine in your domain that has the Exchange management tools installed.

  2. Open the ADUC snap-in (Users and Computers.msc).

  3. Navigate to the domain and container (or OU) that you want to host the new group.

  4. Right-click the target container and choose the New Query-based Distribution Group command.

    You can only create and use query-based distribution groups when your Exchange organization is in native mode and has Exchange 2000 SP3 or later on all servers. Your global catalog servers can be running Windows 2000 (with the DynamicDLPageSize key set; see MS KB 822897) or Windows Server 2003. If you try to perform step 4 while your organization is in mixed mode, you'll get a polite error dialog explaining that you must go native before creating any QDGs; if you don't adjust DynamicDLPageSize, you may find that QDGs aren't reliably expanded.


  5. When the New Object - Query-based Distribution Group dialog appears, enter a name for the QDG; optionally, you can enter a separate alias (but if you don't, the name will be used as the alias). Click Next.

  6. The filter specification dialog (see Figure 5-5) will appear:

    • Use the Change button to select the container scope that the QDG is restricted to; by default, the QDG will be restricted to the Users container in the domain where you created the QDG.

    • Use the controls in the Filter group to select which objects are included in the QDG. Most of the time, the Users with Exchange mailbox checkbox will be the only one you select, since most QDGs are intended to encompass users only.

    • Use the Customize filter radio button, and the associated Customize button, to create a customized query for the QDG. When you click Customize, you'll see the Find Exchange Recipients dialog box shown in Figure 5-4; from that dialog, you can find pretty much any AD object and use the resulting query as the basis for your QDG.

Once you've chosen the filter specifications that you want to use, click Next, and then click Finish.

Figure 5-5. Choosing the scope and extent of the QDG filter using this dialog


Using VBScript
' This code creates a new query-based distribution group in the Users  ' container. The QDG contains all users who have Exchange mailboxes. ' ------ SCRIPT CONFIGURATION ------  strDCName = "<serverName>" ' e.g., "CONT-EXBE01"      strContainer= "<container>" ' e.g., "CN=users,dc=robichaux, dc=net"  strQDGName = "<name>"    'e.g., "Mail Users"  strDomain = "@<domain>"    ' e.g., "@robichaux.net"  strFilter = "(&(!cn=SystemMailbox{*})(& (mailnickname=*)" &_              "(|&(objectCategory=person) (objectClass=user)" &_               "(|(homeMDB=*)(msExchHomeServerName=*))) )))" ' ------ END CONFIGURATION --------- Set objContainer = GetObject("LDAP://" & strDCName & "/" & strContainer) Set objQDG = objContainer.Create("msExchDynamicDistributionList", _     "CN=" & strQDGName) With objQDG   .Put "msExchDynamicDLFilter", strFilter   .Put "displayName", strQDGName   .Put "mailNickname", strQDGName   .Put "reportToOriginator", True   .Put "proxyAddresses", "SMTP:" & strQDGName & strDomain   .Put "legacyExchangeDN", "/o=<orgName>/ou=<adminGrp>/cn=Recipients/cn=" &             strQDGName   ' e.g. "/o=Robichaux and Associates/ou=First Administrative    '       Group/cn=Recipients/cn=" & strQDGName   .put "msExchDynamicDLBaseDN", strContainer   .Put "systemFlags", 1610612736   .SetInfo  End With Wscript.echo "Created QDG " & strQDGName

Discussion

Query-based distribution groups are probably better known by their original name: dynamic DLs. The idea behind QDGs is that you should be able to define some set of search criteria that can be used to populate a DL, and that when objects' properties change such that they should be included in, or excluded from, the DL, the DL should automatically be updated somehow. When you create a QDG, you must specify an LDAP filter that selects the objects you want. The filter in the listing above is the one generated by the ESM GUI when you create a new QDG; notice that it excludes items named "System Mailbox" and any item that isn't a user or that doesn't have an Exchange home server defined. You can specify more complex LDAP filters to selectively limit QDG membership to particular OUs or subgroups of users. One thing to bear in mind when designing your QDG queries is that the query will be executed each time the QDG is expanded. Each message sent to the QDG will cause an expansion, depending on where the sender is and which server is responsible for the expansion process. For complex queries, or for large result sets, the performance impact on your GCs and Exchange servers can be significant. You can work around this to an extent by designating a specific expansion server for the QDG (or any other DG); this doesn't reduce the load, but it does let you control where it goes.

Another very important aspect of QDGs is that each has a legacyExchangeDN attribute, just like a mailbox. Also just like mailboxes, the legacyExchangeDN value for each QDG must be unique in the forest. If you create multiple QDGs with the same name (say, one in each domain of a multidomain forest), you must be certain that the legacyExchangeDN values for each QDG are distinct.

See Also

MS KB 822897 (How to Troubleshoot Query-Based Distribution Groups) and MS KB 839949 (Troubleshooting mail transport and distribution groups in Exchange 2000 Server and in Exchange Server 2003)



Exchange Server Cookbook
Exchange Server Cookbook: For Exchange Server 2003 and Exchange 2000 Server
ISBN: 0596007175
EAN: 2147483647
Year: 2006
Pages: 235

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net