Set Send As Permission Office 365 using Powershell

We can set or grant send as permission for an office 365 mailbox using the powershell cmdlet Add-RecipientPermission .

Note: Before proceed, Connect Exchange Online Remote PowerShell.

Run the following command to grant send as permission to Morgan on the user Kevin’s mailbox.

Add-RecipientPermission Kevin -Trustee Morgan -AccessRights SendAs -Confirm:$False

Trustee – The mailbox that should be granted the send as permission.

Set Send As Permissions for Bulk Mailboxes from Text file

Use the below powershell script to configure Send As permission for bulk office 365 mailboxes from text file. First create the text file Mailboxes.txt which includes one mailbox in each line.

Get-Content C:Mailboxes.txt | ForEach-Object{
 $mailbox = $_
 Add-RecipientPermission $mailbox -Trustee <user> -AccessRights SendAs -Confirm:$False
}

Set Send As Access for Multiple Users and Multiple Trustee from CSV file

We may required to grant Send As access for multiple users in multiple users’ mailbox, in this case we can have mailbox and trustee names in csv file. Consider the csv file “MailboxTrusteeDetails.csv” that has two column headers “TargetMailbox” and “Trustee”.

Your CSV file should include the details in below format.

TargetMailbox,Trustee
MailboxUser1,TrusteeUser1
MailboxUser1,TrusteeUser2
MailboxUser2,TrusteeUser3
MailboxUser2,TrusteeUser4

Run the following commands to import details from CSV file and add Send As permission.

Import-Csv 'C:\MailboxTrusteeDetails.csv' | ForEach-Object{
$mailbox = $_."TargetMailbox"
$trustee = $_."Trustee"
Add-RecipientPermission $mailbox -Trustee $trustee -AccessRights SendAs -Confirm:$False
}

Grant Send As access to all Mailboxes in Office 365

Use the below powershell script to configure send as permission for all the mailbox users in your Office 365.

$MBXS = Get-Recipient -RecipientType UsermMilbox 
ForEach ($MBX in $MBXS) 
{ 
Add-RecipientPermission $MBX.name -AccessRights SendAs –Trustee <user> -Confirm:$False 
}

List all send as permissions

If you want to list all the configured send as permissions, use the below command.

Get-RecipientPermission | Where {($_.Trustee -ne 'nt authorityself') -and ($_.Trustee -ne 'null sid')}
Advertisement

5 thoughts on “Set Send As Permission Office 365 using Powershell”

  1. What if you have more then one mailbox user that needs access to the same Trustee mailbox? How will you format the list?

    TargetMailbox, Trustee
    MailboxUser1,mailboxUser2,TrusteeUser1

    Reply

Leave a Comment