The Exchange admin centre covers the basics but PowerShell is much faster when you're working with multiple mailboxes, need to script recurring tasks, or want to make changes that the GUI doesn't expose. This guide covers the most common shared mailbox and distribution group tasks you'll run into day-to-day.
Connect to Exchange Online
# Install the module if you haven't already
Install-Module -Name ExchangeOnlineManagement -Force
# Connect - this opens a browser auth prompt
Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com
Shared Mailboxes
📬 Shared MailboxesCreate a new shared mailbox
New-Mailbox -Shared -Name "IT Support" -DisplayName "IT Support" -Alias itsupport -PrimarySmtpAddress "itsupport@yourdomain.com"
Give a user Full Access to a shared mailbox
Add-MailboxPermission -Identity "itsupport@yourdomain.com" -User "jane@yourdomain.com" -AccessRights FullAccess -AutoMapping $true
# AutoMapping:$true makes the mailbox appear automatically in Outlook
Give Send As permission
Add-RecipientPermission -Identity "itsupport@yourdomain.com" -Trustee "jane@yourdomain.com" -AccessRights SendAs -Confirm:$false
Convert a regular mailbox to shared
This is useful when an employee leaves and you want to keep the mailbox accessible to their team without paying for an ongoing licence.
# Convert to shared first
Set-Mailbox -Identity "leaveruser@yourdomain.com" -Type Shared
# Then remove the licence from the account in Entra ID / M365 admin
# Shared mailboxes under 50GB don't need a licence
Hide a shared mailbox from the Global Address List
Set-Mailbox -Identity "itsupport@yourdomain.com" -HiddenFromAddressListsEnabled $true
Add a secondary email address (alias)
Set-Mailbox -Identity "itsupport@yourdomain.com" -EmailAddresses @{Add="it@yourdomain.com"}
Distribution Groups
📋 Distribution GroupsCreate a distribution group
New-DistributionGroup -Name "All Staff" -Alias allstaff -PrimarySmtpAddress "allstaff@yourdomain.com" -MemberJoinRestriction Closed
Add members to a distribution group
Add-DistributionGroupMember -Identity "All Staff" -Member "jane@yourdomain.com"
# Add multiple from a CSV
Import-Csv "C:\users.csv" | ForEach-Object {{
Add-DistributionGroupMember -Identity "All Staff" -Member $_.Email
}}
List all members of a group
Get-DistributionGroupMember -Identity "All Staff" | Select-Object Name, PrimarySmtpAddress
Allow external senders to email a distribution group
By default, distribution groups only accept mail from internal senders. To allow external email:
Set-DistributionGroup -Identity "All Staff" -RequireSenderAuthenticationEnabled $false