Applies to: Exchange Server 2007
Topic Last Modified: 2007-10-23

Use the New-DynamicDistributionGroup cmdlet to create a new dynamic distribution group.

Syntax

New-DynamicDistributionGroup -Name <String> -IncludedRecipients <Nullable> -OrganizationalUnit <OrganizationalUnitIdParameter> [-Alias <String>] [-ConditionalCompany <MultiValuedProperty>] [-ConditionalCustomAttribute1 <String>] [-ConditionalCustomAttribute10 <String>] [-ConditionalCustomAttribute11 <String>] [-ConditionalCustomAttribute12 <String>] [-ConditionalCustomAttribute13 <String>] [-ConditionalCustomAttribute14 <String>] [-ConditionalCustomAttribute15 <String>] [-ConditionalCustomAttribute2 <String>] [-ConditionalCustomAttribute3 <String>] [-ConditionalCustomAttribute4 <String>] [-ConditionalCustomAttribute5 <String>] [-ConditionalCustomAttribute6 <String>] [-ConditionalCustomAttribute7 <String>] [-ConditionalCustomAttribute8 <String>] [-ConditionalCustomAttribute9 <String>] [-ConditionalDepartment <MultiValuedProperty>] [-ConditionalStateOrProvince <MultiValuedProperty>] [-DisplayName <String>] [-DomainController <Fqdn>] [-RecipientContainer <OrganizationalUnitIdParameter>] [-TemplateInstance <PSObject>]
New-DynamicDistributionGroup -Name <String> -OrganizationalUnit <OrganizationalUnitIdParameter> -RecipientFilter <String> [-Alias <String>] [-DisplayName <String>] [-DomainController <Fqdn>] [-RecipientContainer <OrganizationalUnitIdParameter>] [-TemplateInstance <PSObject>]

Parameters

Parameter Required Type Description

IncludedRecipients

Required

System.Nullable

The IncludedRecipients parameter filters the recipient types that are used to build the dynamic distribution group. The IncludedRecipients parameter cannot be used if the RecipientFilter parameter is specified.

The available values for the IncludedRecipients parameter are AllRecipients, MailboxUsers, Resources, MailContacts, MailGroups, Mail Users, and None.

AllRecipients can be used only by itself. When multiple values of IncludedRecipients are separated by commas, the OR Boolean operator is applied.

Name

Required

System.String

The Name parameter specifies the name of the dynamic distribution group. If the DisplayName parameter is not specified, the value of Name is also used for DisplayName.

The Name value cannot exceed 64 characters.

If the values of Name and DisplayName are different:

  • Name specifies the dynamic distribution group name in Active Directory Users and Computers and also in the Group Name field in the Exchange Management Console.

  • DisplayName specifies the dynamic distribution group name in the Exchange Management Console, and in the Exchange global address list (GAL).

OrganizationalUnit

Required

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The OrganizationalUnit parameter specifies where to create the dynamic distribution group in Active Directory by using canonical name syntax.

RecipientFilter

Required

System.String

The RecipientFilter parameter filters the mail-enabled recipients that are used to build the dynamic distribution group. RecipientFilter cannot be used if any of the following parameters are specified:

  • IncludedRecipients

  • ConditionalCompany

  • ConditionalCustomAttribute N (where N is a value from 1 through 15)

  • ConditionalDepartment

  • ConditionalStateOrProvince

RecipientFilter uses OPath syntax to query Active Directory and filter recipients.

For more information about the filterable properties, see Filterable Properties for the -RecipientFilter parameter.

Alias

Optional

System.String

The Alias parameter specifies the alias of the dynamic distribution group. The value of Alias is used to generate the primary Simple Mail Transfer Protocol (SMTP) e-mail address for the dynamic distribution group. The value of Alias cannot contain spaces. If the Alias parameter is not specified, the value of the Name parameter is used for the value of the Alias parameter, with any spaces in the Name parameter converted to underscore characters (_).

ConditionalCompany

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ConditionalCompany parameter filters the mailbox users or mail-enabled contacts that are used to build the dynamic distribution group.

When multiple values of the ConditionalCompany parameter are separated by commas, the OR Boolean operator is applied.

ConditionalCustomAttribute1

Optional

System.String

The ConditionalCustomAttribute1 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute10

Optional

System.String

The ConditionalCustomAttribute10 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute11

Optional

System.String

The ConditionalCustomAttribute11 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute12

Optional

System.String

The ConditionalCustomAttribute12 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute13

Optional

System.String

The ConditionalCustomAttribute13 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute14

Optional

System.String

The ConditionalCustomAttribute14 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute15

Optional

System.String

The ConditionalCustomAttribute15 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute2

Optional

System.String

The ConditionalCustomAttribute2 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute3

Optional

System.String

The ConditionalCustomAttribute3 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute4

Optional

System.String

The ConditionalCustomAttribute4 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute5

Optional

System.String

The ConditionalCustomAttribute5 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute6

Optional

System.String

The ConditionalCustomAttribute6 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute7

Optional

System.String

The ConditionalCustomAttribute7 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute8

Optional

System.String

The ConditionalCustomAttribute8 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalCustomAttribute9

Optional

System.String

The ConditionalCustomAttribute9 parameter specifies custom attributes. You can use these attributes to store additional information.

ConditionalDepartment

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ConditionalDepartment parameter filters the mailbox users or mail-enabled contacts that are used to build the dynamic distribution group. ConditionalDepartment cannot be used if the RecipientFilter parameter is specified.

When multiple values of ConditionalDepartment are separated by commas, the OR Boolean operator is applied.

ConditionalStateOrProvince

Optional

Microsoft.Exchange.Data.MultiValuedProperty

The ConditionalStateOrProvince parameter filters mailbox users or mail-enabled contacts that are used to build the dynamic distribution group. ConditionalStateOrProvince cannot be used if the RecipientFilter parameter is specified.

When multiple values of ConditionalStateOrProvince are separated by commas, the OR Boolean operator is applied.

DisplayName

Optional

System.String

The DisplayName parameter specifies the name of the dynamic distribution group in the Exchange Management Console and in the Exchange global address list (GAL). If the DisplayName parameter is not specified, the value of the Name parameter is used for DisplayName.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

To specify the fully qualified domain name (FQDN) of the domain controller that writes this configuration change to Active Directory, include the DomainController parameter.

RecipientContainer

Optional

Microsoft.Exchange.Configuration.Tasks.OrganizationalUnitIdParameter

The RecipientContainer parameter filters the recipients that are used to build the dynamic distribution group based on their location in Active Directory. The value of RecipientContainer can be the canonical name of an organizational unit (OU) or a domain. If you do not specify a value for RecipientContainer, the default search filter is the location of the dynamic distribution group in Active Directory. This location is specified by using the OrganizationalUnit parameter.

TemplateInstance

Optional

System.Management.Automation.PSObject

When an existing object is supplied to the TemplateInstance parameter, the command uses the configuration of that object to create a copy of the object.

Detailed Description

A dynamic distribution group queries Active Directory directory service mail-enabled objects and builds the group membership based on the results. The group membership is recalculated whenever an e-mail message is sent to the group. The query filters provided with Exchange are limited to any combination of the following parameters:

  • ConditionalCompany

  • ConditionalCustomAttribute N (where N is a value from 1 through 15)

  • ConditionalDepartment

  • ConditionalStateOrProvince

  • IncludedRecipients

You can also create any custom query using the RecipientFilter parameter.

To run the New-DynamicDistributionGroup cmdlet, the account you use must be delegated the following:

  • Exchange Recipient Administrator role

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

Input Types

Return Types

Errors

Error Description

 

 

Exceptions

Exceptions Description

  

 

Example

The following code examples show how to use the New-DynamicDistributionGroup command.

The first example creates a new dynamic distribution group that is named Marketing Group in the Users container in the Contoso.com domain. The Marketing Group dynamic distribution group contains all mailbox users or mail-enabled contacts found anywhere in the Contoso.com domain who have a Department field that contains "Marketing" or "Sales".

The second example uses the RecipientFilter parameter to create a dynamic distribution group that is named Pacific Northwest in the Users container in the Contoso.com domain. The Pacific Northwest dynamic distribution group contains all mailbox users found anywhere in the Contoso.com domain who have a State/Province field that contains "Washington" or "Oregon".

Copy Code
New-DynamicDistributionGroup -Name "Marketing Group" -Alias "Marketing_Group" -IncludedRecipients "MailboxUsers,MailContacts" -OrganizationalUnit "Contoso.com/Users" -ConditionalDepartment "Marketing","Sales" -RecipientContainer "Contoso.com"
New-DynamicDistributionGroup -Name "Pacific Northwest" -Alias "Pacific_Northwest" -OrganizationalUnit "Contoso.com/Users" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and ((StateOrProvince -eq 'Washington' -or StateOrProvince -eq 'Oregon')))} -RecipientContainer "Contoso.com"