Commands › Exchange Online

New-DynamicDistributionGroup

Exchange Online ExchangeOnlineManagement New-*

Create dynamic distribution groups. A dynamic distribution group queries mail-enabled objects and builds the group membership based on the results. The group membership is recalculated whenever an email message is sent to the group.

Quick start script

# New-DynamicDistributionGroup — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-ExchangeOnline -CertificateThumbprint $thumb -AppId $appId -Organization $org

# 2. Capture the current state first — you cannot roll back what you never recorded
$before = Get-DynamicDistributionGroup
$before | Format-List

# 3. Make the change (dry run first)
New-DynamicDistributionGroup -Name <String> -IncludedRecipients <WellKnownRecipientType> -RecipientFilter <String> -WhatIf
New-DynamicDistributionGroup -Name <String> -IncludedRecipients <WellKnownRecipientType> -RecipientFilter <String>

# 4. Verify and diff
$after = Get-DynamicDistributionGroup
Compare-Object ($before | Out-String) ($after | Out-String)

Syntax — 2 parameter sets

PrecannedFilter

New-DynamicDistributionGroup [-Name] <String> -IncludedRecipients <WellKnownRecipientType>
 [-Alias <String>]
 [-ArbitrationMailbox <MailboxIdParameter>]
 [-ConditionalCompany <MultiValuedProperty>]
 [-ConditionalCustomAttribute1 <MultiValuedProperty>]
 [-ConditionalCustomAttribute10 <MultiValuedProperty>]
 [-ConditionalCustomAttribute11 <MultiValuedProperty>]
 [-ConditionalCustomAttribute12 <MultiValuedProperty>]
 [-ConditionalCustomAttribute13 <MultiValuedProperty>]
 [-ConditionalCustomAttribute14 <MultiValuedProperty>]
 [-ConditionalCustomAttribute15 <MultiValuedProperty>]
 [-ConditionalCustomAttribute2 <MultiValuedProperty>]
 [-ConditionalCustomAttribute3 <MultiValuedProperty>]
 [-ConditionalCustomAttribute4 <MultiValuedProperty>]
 [-ConditionalCustomAttribute5 <MultiValuedProperty>]
 [-ConditionalCustomAttribute6 <MultiValuedProperty>]
 [-ConditionalCustomAttribute7 <MultiValuedProperty>]
 [-ConditionalCustomAttribute8 <MultiValuedProperty>]
 [-ConditionalCustomAttribute9 <MultiValuedProperty>]
 [-ConditionalDepartment <MultiValuedProperty>]
 [-ConditionalStateOrProvince <MultiValuedProperty>]
 [-Confirm]
 [-DirectMembershipOnly <Boolean>]
 [-DisplayName <String>]
 [-ManagedBy <GeneralRecipientIdParameter>]
 [-DomainController <Fqdn>]
 [-ModeratedBy <MultiValuedProperty>]
 [-ModerationEnabled <Boolean>]
 [-Notes <String>]
 [-OrganizationalUnit <OrganizationalUnitIdParameter>]
 [-PrimarySmtpAddress <SmtpAddress>]
 [-RecipientContainer <OrganizationalUnitIdParameter>]
 [-SendModerationNotifications <TransportModerationNotificationFlags>]
 [-WhatIf]
 [<CommonParameters>]

CustomFilter

New-DynamicDistributionGroup [-Name] <String> -RecipientFilter <String>
 [-Alias <String>]
 [-ArbitrationMailbox <MailboxIdParameter>]
 [-Confirm]
 [-DirectMembershipOnly <Boolean>]
 [-DisplayName <String>]
 [-ManagedBy <GeneralRecipientIdParameter>]
 [-DomainController <Fqdn>]
 [-ModeratedBy <MultiValuedProperty>]
 [-ModerationEnabled <Boolean>]
 [-Notes <String>]
 [-OrganizationalUnit <OrganizationalUnitIdParameter>]
 [-PrimarySmtpAddress <SmtpAddress>]
 [-RecipientContainer <OrganizationalUnitIdParameter>]
 [-SendModerationNotifications <TransportModerationNotificationFlags>]
 [-WhatIf]
 [<CommonParameters>]

Parameters (36)

ParameterTypeRequiredWhat it controls
-Name String yes The Name parameter specifies the unique name of the dynamic distribution group. The maximum length is 64 characters. If the value contains spaces, enclose the value in quotation marks (").
-IncludedRecipients WellKnownRecipientType yes The IncludedRecipients parameter specifies a precanned filter that's based on the recipient type. Valid values are:
-RecipientFilter String yes The RecipientFilter parameter specifies a custom OPATH filter that's based on the value of any available recipient property. You can use any available Windows PowerShell operator, and wildcards and partial matches...
-Alias String The Alias parameter specifies the Exchange alias (also known as the mail nickname) for the recipient. This value identifies the recipient as a mail-enabled object, and shouldn't be confused with multiple email...
-ArbitrationMailbox MailboxIdParameter This parameter is available only in on-premises Exchange.
-ConditionalCompany MultiValuedProperty The ConditionalCompany parameter specifies a precanned filter that's based on the value of the recipient's Company property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute1 MultiValuedProperty The ConditionalCustomAttribute1 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute1 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute10 MultiValuedProperty The ConditionalCustomAttribute10 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute10 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute11 MultiValuedProperty The ConditionalCustomAttribute11 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute11 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute12 MultiValuedProperty The ConditionalCustomAttribute12 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute12 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute13 MultiValuedProperty The ConditionalCustomAttribute13 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute13 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute14 MultiValuedProperty The ConditionalCustomAttribute14 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute14 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute15 MultiValuedProperty The ConditionalCustomAttribute15 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute15 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute2 MultiValuedProperty The ConditionalCustomAttribute2 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute2 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute3 MultiValuedProperty The ConditionalCustomAttribute3 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute3 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute4 MultiValuedProperty The ConditionalCustomAttribute4 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute4 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute5 MultiValuedProperty The ConditionalCustomAttribute5 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute5 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute6 MultiValuedProperty The ConditionalCustomAttribute6 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute6 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute7 MultiValuedProperty The ConditionalCustomAttribute7 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute7 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute8 MultiValuedProperty The ConditionalCustomAttribute8 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute8 property. You can specify multiple values separated by commas.
-ConditionalCustomAttribute9 MultiValuedProperty The ConditionalCustomAttribute9 parameter specifies a precanned filter that's based on the value of the recipient's CustomAttribute9 property. You can specify multiple values separated by commas.
-ConditionalDepartment MultiValuedProperty The ConditionalDepartment parameter specifies a precanned filter that's based on the value of the recipient's Department property. You can specify multiple values separated by commas.
-ConditionalStateOrProvince MultiValuedProperty The ConditionalStateOrProvince parameter specifies a precanned filter that's based on the value of the recipient's StateOrProvince property. You can specify multiple values separated by commas.
-Confirm SwitchParameter The Confirm switch specifies whether to show or hide the confirmation prompt. How this switch affects the cmdlet depends on whether the cmdlet requires confirmation before proceeding.
-DirectMembershipOnly Boolean This parameter is available only in the cloud-based service.
-DisplayName String The DisplayName parameter specifies the display name of the dynamic distribution group. The display name is visible in the Exchange admin center and in address lists. The maximum length is 256 characters. If the...
-DomainController Fqdn This parameter is available only in on-premises Exchange.
-ManagedBy GeneralRecipientIdParameter This parameter is available only in the cloud-based service.
-ModeratedBy MultiValuedProperty The ModeratedBy parameter specifies one or more moderators for this recipient. A moderator approves messages sent to the recipient before the messages are delivered. A moderator must be a mailbox, mail user, or mail...
-ModerationEnabled Boolean The ModerationEnabled parameter specifies whether moderation is enabled for this recipient. Valid value are:
-Notes String This parameter is available only in the cloud-based service.
-OrganizationalUnit OrganizationalUnitIdParameter The OrganizationalUnit parameter specifies the organizational unit (OU) where the dynamic distribution group is created.
-PrimarySmtpAddress SmtpAddress The PrimarySmtpAddress parameter specifies the primary return email address that's used for the recipient.
-RecipientContainer OrganizationalUnitIdParameter The RecipientContainer parameter specifies a filter that's based on the recipient's location in Active Directory. Valid input for this parameter is an organizational unit (OU) or domain that's returned by the...
-SendModerationNotifications TransportModerationNotificationFlags The SendModerationNotifications parameter specifies when moderation notification messages are sent. Valid values are:
-WhatIf SwitchParameter The WhatIf switch shows what the command does without making any changes. You don't need to specify a value with this switch.

Message Center changes mentioning this command

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.