Office 365 Remove mailbox folder permissions recursively and in Bulk

Use this script to recursively remove permissions on all user-accessible folders in a mailbox. Multiple values are supported for both the Mailbox and User parameters, allowing you to use the script for BULK editing. Refer to the built-in help for additional details.

787 times
Add to favorites
Office 365
E-mail Twitter Digg Facebook
Sign in to ask a question

  • No Matching Security Principals Found
    3 Posts | Last post August 15, 2019
    • I keep getting this error message when trying to run the script...
      WARNING: Security principal with identifier <first.last> not found, skipping...
      No matching security principals found, check the parameter values.
      At ps1:121 char:45
      + ... t -eq 0)) { Throw "No matching security principals found, check the p ...
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : OperationStopped: (No matching sec...rameter values.:String) [], RuntimeException
          + FullyQualifiedErrorId : No matching security principals found, check the parameter values.
      I can run the Get-MailboxFolderStatistics command with a <first.last> identifier, so no sure why it's not working with the script.
    • Okay... think I figured it out...
      first.last is how our Alias is set up.
      Even though this works: Get-MailboxFolderStatistics first.last
      This does not: Get-SecurityPrincipal first.last
      This does work however: Get-SecurityPrincipal "first last"
      I can use our Alias for the Mailbox, but have to use "first last" for the User.  I tested and it works.
      Thank you for the Script!
    • Glad you figured it out :)
      Since the script allows for a "string" input for the username, you should make sure to provide something the Get-SecurityPrincipal cmdlet can resolve, and of course something that will return an unique/single match. UPNs, Primary SMTP address, GUIDs are all a good match, alias/mailnickname might work in some cases, but not all.
  • Does it remove Send on Behalf Permissions as well?
    1 Posts | Last post July 07, 2018
    • This script is really great to remove mailbox folder permissions. it worked for me where I had to delete folder permissions from number of mailboxes.
      I noticed that this script also removes send on behalf permissions of other users for that mailbox.
      I have to apply send on behalf permissions again after each time I remove any folder permissions using this script.
      Please advise.
      Thanks again for Script. it made it easy to remove bulk permissions.