Articles in the "Meeting cancellation script" series
- Cancel future meetings in a mailbox
- Meeting cancellation script updated [This article]
- Meeting cancellation script updated for large result sets
I have updated the Cancel-MailboxMeetings.ps1 script. These are the changes:
- Changed the date parameters to align with Microsoft’s Remove-CalendarEvents cmdlet. StartDate is now QueryStartDate and EndDate is now QueryWindowInDays. The default time frame is still one year from the query start date, but is now specified as an integer of days instead of a specific date.
- Added a preview mode via the PreviewOnly switch parameter (also to align with Microsoft). Using the parameter will list which meetings (by subject and start date, first occurrence start date if a recurring meeting) would be affected. To provide enough detail, it will indicate if it is a standalone meeting or series and whether the meeting is being canceled (because the mailbox is the organizer) or declined (because the mailbox is an attendee). If you use the EndOrganizedRecurringMeetings parameter, it will also use wording to show that a meeting series’ end date would be updated instead of canceled.
- Added detection of modified occurrences that will be lost if a recurring series’ end date is changed. Because exceptions to a meeting (only modifications, not deletions) are removed when a series’ end date is changed, the script checks for modified occurrences that occurred in the past of the query start date and prompts you to confirm that you want to update that meeting.
- Added a switch parameter named SuppressLostExceptionPrompt. Use this if you want to prevent the confirmation prompt about lost modified occurrences and have it change the end date anyway. This parameter only has an effect if also used with EndOrganizedRecurringMeetings.
- Although added only while I was testing, but decided to leave in, are some extra details written to the screen if you use the Verbose parameter.
The code in the first post has been updated, as has the downloadable version:
Cancel-MailboxMeetings.ps1 (12.7 KiB)
There’s an error at line 105.
There’s no $mailbox .
Changed the line to
Now impersonation works like a charm.
Thanks for catching that. I must have copied the line from another script where it was using a mailbox object. I will update the download source.
Thanks for sharing this great script,
But i having a few issues and couldn’t determine cause
I’m getting error below when running with “-IncludeAttendeeMeetings” parameter. PreviewOnly option is also included.
I have troubles with some mailboxes, throwing an exception:
“You have exceeded the maximum number of objects that can be returned for the find operation. Use paging to reduce the result size and try your request again”
Any idea to implement paging into your script?
You think you could add paging, since I’m getting some exceptions, when large numbers of appointments get returned?
I have updated the script to accommodate data sets that are larger than the maximum of 1000 items in a search result.
This is because a single-instance meeting can sometimes have a property incorrectly indicate that it is recurring. I have updated the script to not use this property to identify single-instance versus recurring meetings.
Thanks Scott. Great Script!