I've been asked to remove a user from mailbox full access permissions. I need this one for every mailbox in the company or specific users (around 180).
So that's what I did so far:
Remove-MailboxPermission -Identity "John Duo" -User "Nik Biessen" -AccessRights FullAccess -InheritanceType All
This removes the delegation rights from one user. I need the same thing just for all mailboxes or a list of them to be executed in one script.
Thanks in advance
CodePudding user response:
You can easily do it using a foreach loop.
Get-Mailbox -ResultSize Unlimited |Foreach {Remove-MailboxPermission -Identity $_.samaccountname -User "Nik Biessen" -AccessRights FullAccess -InheritanceType All}
Hope Nik Biessen is the user who got access, which needs to be removed. Please note that the csv file needs a header as ID in the first line.
Note - Code is not tested. Please test it before running it in a production environment.