Skip to content

Instantly share code, notes, and snippets.

@supermarsx
Created September 8, 2025 15:06
Show Gist options
  • Save supermarsx/be052d27e76e3ac2a18ff247f59eb443 to your computer and use it in GitHub Desktop.
Save supermarsx/be052d27e76e3ac2a18ff247f59eb443 to your computer and use it in GitHub Desktop.
Exchange remove auto mapping mailboxes for user
# Set the user to fix
$user = "DOMAIN\UserName"
# Reapply FullAccess with AutoMapping disabled on every mailbox where the user currently has FullAccess
Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox,SharedMailbox,RoomMailbox,EquipmentMailbox |
Where-Object {
Get-MailboxPermission -Identity $_.Identity -User $user -ErrorAction SilentlyContinue |
Where-Object { $_.AccessRights -contains "FullAccess" -and -not $_.IsInherited }
} | ForEach-Object {
Remove-MailboxPermission -Identity $_.Identity -User $user -AccessRights FullAccess -Confirm:$false
Add-MailboxPermission -Identity $_.Identity -User $user -AccessRights FullAccess -AutoMapping:$false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment