Is it possible to achieve this for multiple users CSV import etc.
I have used the following for individual accounts before but not sure how to apply it to multiple accounts
Remove-MailboxPermission -Identity Sharedmailbox -User USER -AccessRights FullAccess,SendAs,ExternalAccount,DeleteItem,ReadPermission,ChangePermission,ChangeOwner -InheritanceType All
Also is there a way to revert this if needed so basically adding all the same users with a Script
Thanks in advance
You need to get all permission first with
Get-Mailboxpermission
command.https://learn.microsoft.com/en-us/powershell/module/exchange/get-mailboxpermission?view=exchange-ps
After it, you can iterate through the collection with a foreach. And call the
Remove-MailboxPermission
cmdlet with the needed attributes.https://learn.microsoft.com/en-us/powershell/module/exchange/remove-mailboxpermission?view=exchange-ps
Something like this (sidenote: I can’t test it from phone but I will check it tomorrow from pc):
Edit: Or you can check this site and try the scripts on it. https://morgantechspace.com/2019/11/remove-mailbox-permissions-using-powershell.html