Add email aliases in bulk

IniobongNkanga-8038 966 Reputation points
2024-08-12T21:07:51.44+00:00

Hello

Please i need your help on this issue.

We added two domains to our tenant. Is it possible to add new aliases in bulk to ALL mailboxes using these two new domains? I know how to do it one by one, but this would take too much time. See below the article I am referring to.

https://learn.microsoft.com/en-us/microsoft-365/admin/email/add-another-email-alias-for-a-user?view=o365-worldwide&redirectSourcePath=%252fen-us%252farticle%252fAdd-additional-email-aliases-to-a-user-in-Office-365-0b0bd900-68b1-4bf5-808b-5d240a7739f4

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,184 questions
Outlook | Windows | Classic Outlook for Windows | For business
Exchange | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2024-08-13T03:04:41.04+00:00

    hi,@IniobongNkanga-8038

    Thanks for posting your question in the Microsoft Q&A forum.

    If you don't want to manually add a new domain name alias for each user, we recommend that you use the Exchange Online PowerShell script.

    1.Connect to Exchange Online

    Connect-ExchangeOnline -UserPrincipalName ******@yourdomain.com

    2.Get all user mailboxes:

    $mailboxes = Get-Mailbox -ResultSize Unlimited

    3.Loop through each mailbox and add the new aliases:

     foreach ($mailbox in $mailboxes)

     {

    $newAlias1 = $mailbox.Alias + '@newdomain1.com'

    $newAlias2 = $mailbox.Alias + '@newdomain2.com'

    Set-Mailbox -Identity $mailbox.Identity -EmailAddresses @{add=$newAlias1,$newAlias2}

    }

     Below is my test, I only make changes to two users.

    User's image

    Checked the user and found that the alias had been added

    User's image

    If my answer is helpful to you, please mark it as the answer so that other users can refer to it. Thank you for your support and understanding.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.