'Unable to remove mailbox permissions through PowerShell on Exchange 2010 SP1

Using Exchange 2010 SP1 remote powershell, I added permissions for a user using the Add-MailboxPermission cmdlet. Here's the command I used to add permissions...

Add-MailboxPermission user_mailbox -User admin_user -AccessRights FullAccess -InheritanceType All

It worked great. Once I ran it, admin_user had access to user_mailbox's mailbox. Now, when I try to remove those permissions, it fails. Here's the command I used to remove permissions...

Remove-MailboxPermission user_mailbox -User admin_user -AccessRights FullAccess -InheritanceType All

And here's the error it gave...

Object reference not set to an instance of an object. + CategoryInfo : NotSpecified: (:) [Remove-MailboxPermission], Nu llReferenceException + FullyQualifiedErrorId : RemoteHostExecutionException

I'm not sure what this exception means so I'm not sure where to look. Is there any other way to remove mailbox permissions through remote powershell?



Solution 1:[1]

Try the following

Get-MailboxPermission -Identity "user_mailbox" -User "user_with_permission_to_remove" | Remove-MailboxPermission

Solution 2:[2]

I had a corrupt mailbox permission with a user on Exchange 2013. A user had permission to a mailbox using inherited AND specific permissions. Just doing a Remove-MailboxPermission wasn't quite enough. I had to get the permissions then remove the permissions. It removed the corrupted one and skipped the inherited one.

Get-MailboxPermission -identity | Where {$_.user -eq ""} | Remove-MailboxPermission.

Worked like a charm.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Dianne Millen