Delegate to many Mailboxes

I have a user that has been made the delegate of many shared Calendars and would like to be removed as such. Is there a PS that would identify the mailboxes the user is a delegate of, and remove her?

thank you!!
Anthony K O365Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vasil Michev (MVP)Commented:
Try something like this (replace on the last line):

$calendars = Get-Mailbox -RecipientTypeDetails UserMailbox | Get-MailboxFolderStatistics | ? {$_.FolderType -eq "Calendar"} | select @{n="Identity"; e={$_.Identity.Replace("\",":\")}}

$calendars | % {Remove-MailboxFolderPermission -Identity $_.Identity -User }

Open in new window

Vasil Michev (MVP)Commented:
Oh, it will give you errors for mailboxes on which she's not a delegate, but nothing bad will happen. If you want to get rid of the errors, just put a simple if check (though it will make the execution twice as slow!).
Anthony K O365Author Commented:

The person still needs full access to the Calendar. She just needs to be removed as a delegate to avoid receiving constant Calendar reminders
What were the top attacks of Q1 2018?

The Threat Lab team analyzes data from WatchGuard’s Firebox Feed, internal and partner threat intelligence, and a research honeynet, to provide insightful analysis about the top threats on the Internet. Check out our Q1 2018 report for smart, practical security advice today!

Vasil Michev (MVP)Commented:
Oh, I see, that delegate option. You cannot control that with the built-in PowerShell cmdlets. You either have to use Outlook to disable it, or to use some EWS based script as for example:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FOXActive Directory/Exchange EngineerCommented:
Put all the users she has access to in a list and name it as users .csv file  then the file in your temp directory or wherever you want then run the below command

import-Csv c:\temp\users.csv | foreach-object {set-mailboxfolderpermission -Identity usernameofthedelegate:\calendar -AccessRights Reviewer}

change the command to wherever your csv is and after -AccessRights give the level she needs
Anthony K O365Author Commented:
This is very helpful indeed.

Thanks both.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.