In today’s interconnected world, efficient management of email communication is crucial for businesses. Microsoft Exchange Online, part of the Microsoft 365 suite, provides a robust platform for email services. As an IT administrator, perhaps you have just completed your migration of your last on-premises mailbox to Exchange Online using a hybrid configuration and you have chosen to shut down the last Exchange server in your environment. As of late 2023 this is now a supported configuration as outlined in this Microsoft article:
https://learn.microsoft.com/en-us/exchange/manage-hybrid-exchange-recipients-with-management-tools
With the shutdown of the Exchange server, the supported method of management of Exchange Online objects is through PowerShell using the RecipientManagement module. In this blog post, we’ll explore the essential PowerShell commands using the RecipientManagement module to continue to manage your Exchange Online environment while maintaining directory synchronization with Microsoft Entra Connect.
Prerequisites
Before diving into the commands, ensure you have the following prerequisites in place:
- Microsoft 365 Subscription: You need an active Microsoft 365 subscription with Exchange Online licenses.
- Windows PowerShell or PowerShell Core: Install either Windows PowerShell (for Windows) or PowerShell Core (cross-platform) on your machine.
The Recipient Management Module
The RecipientManagement module offers a set of cmdlets specifically designed for managing recipients in Exchange Online. Let’s explore some of the key commands along with examples:
1. Add-PSSnapin *RecipientManagement
This command loads the RecipientManagement
module into your PowerShell session. It’s essential to run this before using other cmdlets from the module. Here’s how you can use it:
Add-PSSnapin *RecipientManagement
2. Set-RemoteMailbox
The Set-RemoteMailbox
cmdlet allows you to modify properties of a remote mailbox. For example, you can change the display name, alias, or even assign a license. Here are two examples:
Example 1: Change the display name of a user’s mailbox:
Set-RemoteMailbox -Identity user@example.com -DisplayName "John Doe"
Example 2: Assign a license to a remote mailbox:
Set-RemoteMailbox -Identity user@example.com -LicenseAssignment "ExchangeOnlinePlan1"
Full documentation here: https://learn.microsoft.com/en-us/powershell/module/exchange/set-remotemailbox?view=exchange-ps
3. Get-RemoteMailbox
Use Get-RemoteMailbox to retrieve information about remote mailboxes. You can filter results based on specific criteria, such as organizational unit (OU) or mailbox type. Here are two examples:
Example 1: Get all remote mailboxes in the “Sales” organizational unit:
Get-RemoteMailbox -OrganizationalUnit "Sales"
Example 2: Retrieve mailbox details for a specific user:
Get-RemoteMailbox -Identity user@example.com | Select-Object DisplayName, Alias, PrimarySmtpAddress
Full documentation here: https://learn.microsoft.com/en-us/powershell/module/exchange/get-remotemailbox?view=exchange-ps
4. New-RemoteMailbox
Creating a new remote mailbox is straightforward with New-RemoteMailbox
. Specify the user’s details, mailbox type, and other relevant parameters:
Example 1: Create a new remote mailbox for Jane Smith:
New-RemoteMailbox -Name "Jane Smith" -UserPrincipalName jane.smith@example.com -Alias jsmith -PrimarySmtpAddress jane.smith@example.com
Example 2: Create a shared mailbox:
New-RemoteMailbox -Name "Support Team" -Shared
Full documentation here: https://learn.microsoft.com/en-us/powershell/module/exchange/new-remotemailbox?view=exchange-ps
5. Remove-RemoteMailbox
When a user leaves the organization, you can use Remove-RemoteMailbox
to disable and remove their mailbox:
Example 1: Disable and remove a user’s mailbox:
Remove-RemoteMailbox -Identity user@example.com -Confirm:$false
Example 2: Remove a shared mailbox:
Remove-RemoteMailbox -Identity "Support Team" -Shared -Confirm:$false
Full documentation here: https://learn.microsoft.com/en-us/powershell/module/exchange/remove-remotemailbox?view=exchange-ps
6. Disable-RemoteMailbox
Temporarily disabling a mailbox without removing it entirely is possible using Disable-RemoteMailbox
:
Example 1: Disable a user’s mailbox:
Disable-RemoteMailbox -Identity user@example.com
Example 2: Disable a shared mailbox:
Disable-RemoteMailbox -Identity "Support Team" -Shared
Full documentation here: https://learn.microsoft.com/en-us/powershell/module/exchange/disable-remotemailbox?view=exchange-ps
7. Enable-RemoteMailbox
To re-enable a previously disabled mailbox, use Enable-RemoteMailbox
:
Example 1: Re-enable a user’s mailbox:
Enable-RemoteMailbox -Identity user@example.com
Example 2: Re-enable a shared mailbox:
Enable-RemoteMailbox -Identity "Support Team" -Shared
Full documentation here: https://learn.microsoft.com/en-us/powershell/module/exchange/enable-remotemailbox?view=exchange-ps
Conclusion
By using these PowerShell commands, you’ll still be able to manage Exchange Online recipients while using Microsoft Entra Connect to sync your local directory. Remember to test any changes in a non-production environment before applying them to your live system.
Have any questions about Exchange Online recipient management using these PowerShell commands? Please reach out to one of our IT experts at any time!