Exchange Export & Import Mailbox permissions

I used this powershell to quickly export Mailbox permissions from one mailbox and set the same permissions on another mailbox.

 $source_mailbox = "[email protected]"
$target_mailbox = "[email protected]"

#Exporting full access permissions
Get-MailboxPermission -Identity $source_mailbox| Where-Object {($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF")} | select Identity, user | Export-csv -path c:\temp\mailboxusers.csv



$Mailboxes = import-csv c:\temp\mailboxusers.csv    
 foreach ($mailbox in $mailboxes) {
     Add-MailboxPermission -Identity $target_mailbox -User $mailbox.user -AccessRights FullAccess -InheritanceType All -AutoMapping:$true
     Add-RecipientPermission -Identity "$target_mailbox" -AccessRights SendAs -Confirm:$false -Trustee $mailbox.user
}


#----------
# if you want to export the share permissions separately 
# ---------
Get-MailboxPermission -Identity $source_mailbox| Where-Object {($_.IsInherited -eq $false) -and -not ($_.User -like "NT AUTHORITY\SELF")} | select Identity, user | Export-csv -path c:\temp\mailbox-sendas-users.csv

Leave a Reply

Your email address will not be published. Required fields are marked *