logo

Distribution Group Management via Set-DistributionGroup

Introduction

A distribution group is a mail-enabled Active Directory group used to send a message to a group of recipients who are members of that group.

Administrators can manage some of the properties and permissions of distribution groups using the Exchange Administration Center (formerly Exchange Management Console). However, this article explains how to perform many common distribution group management tasks using the Exchange Management Shell cmdlets Set-DistributionGroup and Add-DistributionGroupMember.

Add a User to a Distribution Group

To add a user to a distribution group, use the following command:

Add-DistributionGroupMember -Identity "Finance UK" -Member Barbara
Add a User to a Distribution Group

Modify the Ownership of a Distribution Group

You can either add additional owners to a distribution group or overwrite the current set of owners with a new set.

Add Owners to a Distribution Group

To add owners to a distribution group, use the following command:

Set-DistributionGroup “Finance USA” -ManagedBy @{Add='abbey','barbara'}
Add Owners to a Distribution Group

Change the Owner of a Distribution Group

To specify a new owner to replace the current set of owners, use this command:

Set-DistributionGroup -Identity "Finance USA" -ManagedBy Barbara
Change the Owner of a Distribution Group

Allow External Users to Send Email to a Distribution Group

To enable external users to send email to a distribution group, set the value of the parameter
-RequireSenderAuthenticationEnabled to $False, as shown here:

Set-DistributionGroup “Finance USA” -RequireSenderAuthenticationEnabled $False
Allow External Users to Send Email to a Distribution Group

Set the Primary Email Address of a Distribution Group

To set the primary email address of a distribution group, use the following command:

Set-DistributionGroup "Finance UK" -PrimarySmtpAddress finance@contoso.com
Set the Primary Email Address of a Distribution Group

Hide a Distribution Group from the Global Address List (GAL)

To hide a distribution group from the GAL, use this cmdlet:

Set-DistributionGroup "Sales UK" -HiddenFromAddressListsEnabled $True
Hide a Distribution Group from the Global Address List (GAL)

Specify Who Can Send Messages to a Distribution Group

You can use any of several parameters to control who can send messages to a distribution group:

  • -AcceptMessagesOnlyFrom
  • -AcceptMessagesOnlyFromDLMembers
  • -AcceptMessagesOnlyFromSendersOrMembers

-AcceptMessagesOnlyFrom

Use this parameter to specify one or more individuals who are permitted to send messages to the distribution group. Messages from other senders will be refused.

Specify any value that uniquely identifies an individual sender in your organization: mailboxes, mail users or mail contacts. Multiple senders can be entered, separated by commas.

The values are immediately transferred to the AcceptMessagesOnlyFromSendersOrMembers property. Therefore, the -AcceptMessagesOnlyFrom and
-AcceptMessagesOnlyFromSendersOrMembers parameters cannot be used together in the same command.

To see how this parameter works, let’s use the distribution list Marketing. As you can see in the screenshot below, it currently has no values in any of the AcceptMessages parameters:

-AcceptMessagesOnlyFrom

To allow only AbbeyCrawford2 to send messages this distribution list, we can use this command:

Set-DistributionGroup -identity "marketing" -AcceptMessagesOnlyFrom "AbbeyCrawford2"
-AcceptMessagesOnlyFrom

-AcceptMessagesOnlyFromDLMembers

Use this parameter to specify a distribution group that can send messages to the distribution group. All members of the specified group will be permitted to send messages to this recipient group. Messages from other senders will be refused.

Specify any value that uniquely identifies one of your organization’s distribution groups or dynamic distribution groups, as shown here:

Set-DistributionGroup -identity "marketing" -AcceptMessagesOnlyFromDLMember “marketing”
-AcceptMessagesOnlyFromDLMembers

In this example, the Marketing group can receive email from its own members only.

-AcceptMessagesOnlyFromSendersOrMembers

Use this parameter to specify individuals or distribution groups in your organization that are permitted to send messages to the distribution group. Messages from other senders will be refused.

You can use any value that uniquely identifies the sender to define senders for this parameter. Individuals can be mailboxes, mail users or mail contacts, and groups can be distribution groups or dynamic distribution groups. If a group is specified, all members of that group are permitted to send messages to this recipient.

Set-DistributionGroup -identity "marketing" -AcceptMessagesOnlyFromSendersOrMembers “marketing”,”AbbeyCrawford2”
-AcceptMessagesOnlyFromSendersOrMembers

Control Whether Email Address Policies Are Applied to a Distribution Group

Use the -EmailAddressPolicyEnabled parameter to control whether email address policies are applied to a distribution group:

  • True (default): The specified group is subject to email address regulations.
Set-DistributionGroup -identity “marketing” -EmailAddressPolicyEnabled $true
  • False: This specified group is exempt from email address regulations.
Set-DistributionGroup -identity “marketing” -EmailAddressPolicyEnabled $false
Control Whether Email Address Policies Are Applied to a Distribution Group

Specify Who Can Send Messages on Behalf of a Distribution Group

Use the -GrantSendOnBehalf parameter to specify who can send messages on behalf of a distribution group. Messages sent on behalf of the group clearly indicate the individual sender in the From box, but replies are sent to the group rather than that individual.

It is recommended that you specify either a mail user, a mailbox, or a mail-enabled security group for which permissions can be assigned.

Any value that uniquely identifies the sender can be used, such as the following:

  • Name
  • Alias
  • Distinguished Name (DN)
  • Canonical DN
  • Domain\username
  • Email address
  • GUID
  • LegacyExchangeDN
  • SamAccountName
  • User ID or user principal name (UPN)

Here is an example:

Set-DistributionGroup -identity "marketing" -GrantSendOnBehalfTo "AbbeyCrawford2"
Specify Who Can Send Messages on Behalf of a Distribution Group

Specify the Maximum Size of an Email that May Be Sent to a Distribution Group

The -MaxReceiveSize parameter is available only in on-premises Exchange.

Use the -MaxReceiveSize parameter to specify the maximum size of an email message that may be sent to a distribution group. Messages that are larger than the limit are rejected. By default, the value for this parameter is unlimited; however, a size limit might be imposed by another control, such as organization, server, or connector limits.

When entering a value, use one of the following units:

  • B (bytes)
  • KB (kilobytes)
  • MB (megabytes)
  • GB (gigabytes)

If you do not specify a unit, the value will normally be handled as bytes, but small numbers may be rounded up to the closest kilobyte. You can specify any value up to 1.999999 gigabytes.

Note that Base64 encoding increases the size of messages by around 33%, so if, for instance, you specify 64 MB, the actual maximum message size will be around 48 MB. Accordingly, specify a value 33% larger than the actual size limit you want to impose.

To check this value for a particular distribution list, use the command in the following screenshot:

Specify the Maximum Size of an Email that May Be Sent to a Distribution Group

If you want to change the maximum message size, use this cmdlet:

Set-DistributionGroup –identity “marketing” -MaxReceiveSize 5mb
Specify the Maximum Size of an Email that May Be Sent to a Distribution Group

Specify the Maximum Size of an Email that a Distribution Group May Send

The -MaxSendSize parameter is available only in Exchange on-premises.

Use this parameter to specify the maximum size of an email message that a distribution group may send. By default, the value for this parameter is unlimited; however, a size limit might be imposed by another control, such as organization, server, or connector limits.

When specifying a value, use one of the following units:

  • B (bytes)
  • KB (kilobytes)
  • MB (megabytes
  • GB (gigabytes) (gigabytes)

If you do not specify a unit, the value will normally be handled as bytes, but small numbers may be rounded up to the closest kilobyte. You can specify any value up to 1.999999 gigabytes.

Note that Base64 encoding increases the size of messages by around 33%, so if, for instance, you specify 64 MB, the actual maximum message size will be around 48 MB. Accordingly, specify a value 33% larger than the actual size limit you want to impose.

If you want to change the maximum message size, use this cmdlet:

Set-DistributionGroup -identity “marketing” -MaxSendSize 10mb
Specify the Maximum Size of an Email that a Distribution Group May Send
Since 2012, Jonathan Blackwell, an engineer and innovator, has provided engineering leadership that has put Netwrix GroupID at the forefront of group and user management for Active Directory and Azure AD environments. His experience in development, marketing, and sales allows Jonathan to fully understand the Identity market and how buyers think.