Query on Distribution List

Glenn Maxwell 10,751 Reputation points
2024-07-18T22:19:41.7333333+00:00

Hi All,

I have a distribution list (DL) with the display name "TestA" and the email address TestA@contoso.com. I want to rename the DL display name from "TestA" to "TestB" and change the email address from TestA@contoso.com to TestB@contoso.com.

I would still like TestA@contoso.com to remain as a secondary email for TestB@contoso.com, with TestB@contoso.com being the primary email address. Will the secondary email address be visible to users? I do not want it to be visible.

How can I achieve this using PowerShell? Will the syntax be the same for both online and on-premises environments, as I need to achieve this for both? I am using an Exchange 2016 hybrid environment.

Microsoft Exchange Online
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,372 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,490 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
1,994 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xintao Qiao-MSFT 1,405 Reputation points Microsoft Vendor
    2024-07-19T03:11:20.2933333+00:00

    Hi, @Glenn Maxwell

    Based on your description, I understand that you want to do something with the distribution group.

    You can use the following command to rename TestA to TestB:

    Set-DistributionGroup -Identity "TestA" -DisplayName "TestB"
    

    Then, you can use the following command to change the email address from TestA@contoso.com to TestB@contoso.com:

    Set-DistributionGroup -Identity "TestB" -PrimarySmtpAddress TestB@contoso.com
    

    After my test, after I successfully changed my email address, TestA@contoso.com automatically changed to the alias of TestB, i.e. secondary email. If you fail to convert automatically, you can also use the command:

    Set-DistributionGroup -Identity "TestB@contoso.com" -EmailAddresses @{Add="TestA@contoso.com"}
    

    After the above operations, you can use the following command to check whether the changes are completed:

    Get-DistributionGroup -Identity TestB@contoso.com | Format-List Name,PrimarySmtpAddress,EmailAddresses
    

    The operation success is shown in the following figure.

    7.19

    In Microsoft Exchange and Exchange Online, the secondary email address (alias) is not directly visible to the user. When a user views a distribution group on a mail client, they typically only see the primary email address. When you send a message to a secondary email address, the mail client also displays the primary email address of the distribution group.

    Both the above commands can be executed in both online and on-premises.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments