Bulk add alias on all Exchange cloud resource accounts

Craig Turner 20 Reputation points
2024-03-05T13:54:49.8633333+00:00

At the moment all of our room resource accounts have the alias of @domain.co.uk - for better clarity, I'd like to create a sub-domain and add an alias of @rooms.domain.co.uk to all those accounts.

Example:

******@domain.co.uk

Alias:

******@rooms.domain.co.uk

Preferably this would be the primary SMTP address for that account and also based on the existing account name (Room123@, Room456@, etc).

Most of our resource accounts have been created in Exchange Online, not on-prem so a powershell script for this would be very helpful.

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,190 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 119.8K Reputation points MVP Volunteer Moderator
    2024-03-05T17:55:37.0366667+00:00

    You can leverage the Set-Mailbox cmdlet and the -WindowsEmailAddress parameter for this:

    Set-Mailbox room123 -WindowsEmailAddress ******@rooms.domain.co.uk
    

    The above cmdlet will add ******@rooms.domain.co.uk alias and set it as primary, while preserving the previous primary SMTP as secondary one.

    To do this in bulk for all rooms (remove -WhatIf once you are satisfied with the result):

    Get-Mailbox -RecipientTypeDetails RoomMailbox | % { Set-Mailbox $_ -WindowsEmailAddress "$($_.Alias)@rooms.domain.co.uk" -WhatIf }
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most 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.