Remove permissions from Shared Mailboxes in Office 365 using PowerShell

Problem:

How do I remove permissions from shared mailboxes in Office 365 using PowerShell?

Solution:

Run the below code:

$Mailboxes = Get-Content "c:\temp\mailboxes.txt"
foreach($Mailbox in $Mailboxes){
Remove-MailboxPermission -Identity $Mailbox -ResetDefault -Confirm:$false
}

Leave a Reply

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