🚀 Scripting Bulk Mailbox Delegation in Exchange Online
When managing a growing team, you often find yourself in a situation where a lead user (e.g., a department head or administrator) needs access to multiple shared or functional mailboxes.
Manually clicking through the Microsoft 365 Admin Center for 10+ mailboxes is a recipe for boredom and typos. Here is how I solved this using the Exchange Online PowerShell V3 module.
The Scenario
We need to grant one primary user (User A) two specific types of permissions across a list of target mailboxes:
- FullAccess: The ability to open the mailbox, read, and organize emails.
- SendAs: The ability to send emails appearing as the target mailbox address.
The PowerShell Solution
First, ensure you are connected:
Connect-ExchangeOnline
Then, run this script to loop through your targets:
PowerShell
# 1. Define the Lead User (The one receiving the permissions)
$LeadUser = "primary.user@company-it.com" # 2. Define the list of target mailboxes (Shared or User mailboxes)
$TargetMailboxes = @(
"info@company-it.com",
"accounting@company-it.com",
"logistics@company-it.com",
"project-alpha@company-it.com",
"support@company-it.com",
"hr-dept@company-it.com"
) # 3. Apply permissions via loop
foreach ($Mailbox in $TargetMailboxes) {
Write-Host "Processing: $Mailbox" -ForegroundColor Cyan
# Grant Full Access (includes Auto-Mapping for Outlook Desktop)
Add-MailboxPermission -Identity $Mailbox -User $LeadUser -AccessRights FullAccess -InheritanceType All -Confirm:$false
# Grant Send As permissions
Add-RecipientPermission -Identity $Mailbox -Trustee $LeadUser -AccessRights SendAs -Confirm:$false
} Write-Host "Success: All permissions applied." -ForegroundColor Green