Creating a Shared Mailbox in an Exchange Hybrid using PowerShell
This guide will show you how to use PowerShell to create a shared mailbox in an Exchange Hybrid.
Create a shared mailbox using PowerShell
In an Exchange Hybrid with Office 365 mailboxes should be created and managed using the on-premises Exchange server
Creating mailboxes in this way means that the mailbox is created in Exchange on-premises, the user is synced to Office 365 and the AD user object has the right Exchange attributes for a Hybrid environment
- When you create a shared mailbox, an Active Directory user object will be created and automatically disabled
- The shared mailbox will show in your on-premises Exchange server and synced to Office 365
- Shared mailboxes do not need an Office 365 license as they cannot be logged into
On Exchange server - open Exchange Management Shell (run as Administrator)
New-Remotemailbox -Shared -Alias TechLabsSales -OnPremisesOrganizationalUnit `
"OU=Shared Mailboxes,OU=TechLabs,DC=techlabs,DC=me,DC=uk" -Name "TechLabs Sales" `
-SamAccountName Sales -UserPrincipalName sales@techlabs.cloud -PrimarySmtpAddress sales@techlabs.cloud
New-Remotemailbox -Shared -Alias TechLabsSales -OnPremisesOrganizationalUnit ` "OU=Shared Mailboxes,OU=TechLabs,DC=techlabs,DC=me,DC=uk" -Name "TechLabs Sales" ` -SamAccountName Sales -UserPrincipalName EMAIL_ADDRESS -PrimarySmtpAddress EMAIL_ADDRESS
New-RemoteMailbox Options
-PrimarySmtpAddress
Sets the email address you only need to use this option if you want an email address that is different from your address policy
-Archive
Creates an archive mailbox
Directory Sync
- After a directory sync has run, the shared mailbox user will show in Office 365
- By default AD connect directory sync runs every 30 mins
- It might also take 20-30 mins for the shared mailbox to be created in Exchange online
To manually run a directory sync
Logon to your Azure AD connect server and run this PowerShell
Start-ADSyncSyncCycle -PolicyType Delta
Office 365 shared mailbox has been created, there is no need to assign a license to the user
Give users permissions to the shared mailbox
Exchange Online Admin Center
Recipients - Shared - select the mailbox - edit
Mailbox delegation - add the user you want to give permissions to both Full Access and Send As
After about 30-40 mins the shared mailbox will show up in the users Outlook
They might need to close and re-open Outlook for the changes to take effect
Shared mailbox sent item behaviour
Most likely you will want to change this behaviour for shared mailboxes so all users can see the items sent from the shared mailbox in Outlook
Check if Message Copy for Sent As is enabled for a mailbox
Connect to Exchange Online PowerShell
Get-mailbox sales@techlabs.cloud | select MessageCopyForSentAsEnabled 
Set Message Copy for Sent As to true for a mailbox
set-mailbox sales@techlabs.cloud -MessageCopyForSentAsEnabled $True
Remove a shared mailbox
On Exchange server - open Exchange Management Shell (run as Administrator)
Remove-remotemailbox –identity sales@techlabs.cloud
 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		 
		
Comments