Author Posts

August 7, 2013 at 11:55 pm

Any ideas why Remove-MailboxPermission is warning me?

I have a mailbox (TestMailbox) with user access granted on it for TestUser:

PS C:\tmp> Get-MailboxPermission TestMailbox | where {$_.user -like "*TestUser"}
Identity User AccessRights IsInherited Deny
——– —- ———— ———– —-
my.domain.test/Test... MYDOMAIN\TestUser {FullAccess} False False

then I try to remove that ACE:

PS C:\tmp> Get-MailboxPermission TestMailbox | where {$_.user -like "*TestUser"} | Remove-MailboxPermission
Confirm
Are you sure you want to perform this action?
Removing mailbox permission "my.domain.test/Test/TestMailbox" for user "MYDOMAIN\TestUser" with access rights "'FullAccess'".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):
WARNING: Can't remove the access control entry on the object "CN=TestMailbox,OU=Test,DC=my,DC=domain,DC=test" for
account "MYDOMAIN\TestUser" because the ACE doesn't exist on the object.

and I get this ugly yellow warning (I prefer scripts to be silent as long as they work as expected)

obviosly the ACE is gone anyway:

PS C:\tmp> Get-MailboxPermission TestMailbox | where {$_.user -like "*TestUser"}
PS C:\tmp>

when I try to remove it again (now that it's gone already), I get no more warning:

Get-MailboxPermission amx_00001) | where {$_.user -like "*f462075"} | Remove-MailboxPermission

what am I doing wrong? bug or feature? I guess "SilentlyContinue" would fix the issue, but I'd love to understand what I'm doing wrong before I paint over it...

TIA
cornel

August 8, 2013 at 6:43 am

ErrorAction (SilentlyContinue) does not affect Warnings; it only affects errors. So that's why you're not suppressing the warning. You can suppress warnings using the $WarningPreference variable if needed.

As for the root cause of the warning – well, tough to say. On the face of it, looks like a bug.