Remove Automapping From All of a User's Mailbox Permissions
A quick script which will enumerate all mailboxes that a user has access to, and then remove and reapply the mailbox permissions without automapping.
This is generally handy when a users Outlook client is running slowly on startup, due to a profile which has become bloated with many automapped mailboxes.
This is fairly common in Office 365 Exchange Online, as administrators will generally assign mailbox permissions via the EXO ECP GUI.
#modify the first variable to suit your environment
$usersUPN = "nick@aldrid.ge"
#Dont modify below
$usersMailboxes = Get-EXOMailbox |%{Get-Exomailboxpermission -Identity $_.UserPrincipalName | Where-object user -like "nick@aldrid.ge"}
Write-Host "Removing Automapping for user $($usersUPN)" -ForegroundColor Yellow
ForEach($mailbox in $usersMailboxes){
Write-host "Removing access permissions for $($mailbox.Identity)" -ForegroundColor Yellow
Remove-MailboxPermission -Identity $mailbox.Identity -User $mailbox.User -AccessRights FullAccess
Start-Sleep 1
Write-host "Adding access permissions for $($mailbox.Identity)" -ForegroundColor Yellow
Add-MailboxPermission -Identity $mailbox.Identity -user $mailbox.User -AccessRights FullAccess -AutoMapping $false
}