In this post we are going to look at using PowerShell to search and delete specific or all calendar meetings and appointments in an Exchange Mailbox.
Using the Exchange Management Shell or remotely connecting to the Exchange Server in PowerShell.
Query Results –
You can use the below command to firstly check to see how many meetings are currently setup in the mailbox.
-SearchMailbox -identity “UsersMailbox” -SearchQuery kind:meetings -EstimateResultsOnly
Then once you are happy to proceed to the actual deletion of the scheduled meetings you can use the same command just amended to include -DeleteContent instead of -EstimateResultsOnly
-SearchMailbox -identity “UsersMailbox” -SearchQuery kind:meetings -DeleteContent
To refine your search using date/time and also remove recurring meetings –
Check out the extensive guide here (How to / Fix – Delete recurring meetings using PowerShell – Exchange Mailbox)
Additional methods to refine search and deletion –
To search for a specific meeting rather than purging a mailboxes entire calendar, you can use the variety of search options available to fine tune your search.
For instance, querying both the kind of object and the subject, I can search and delete specific meeting or appointments
Search-Mailbox -identity “UsersMailbox” -SearchQuery kind:meetings,subject:”Tea Party at 5!” -DeleteContent
You can also split up multiple property restrictions with (spaces, AND, OR)
Using the same property restriction:
subject:”John Smith” subject:”Jane Smith”
subject:”John Smith” OR subject:”Jane Smith”
When you use different property restrictions, matches are based on an intersection of the property restrictions:
kind:”John Smith” subject:”Meeting”
kind:”John Smith” AND subject:”Meeting”
Such as –
Search-Mailbox -identity “UsersMailbox” -SearchQuery kind:meetings AND subject:”Tea Party at 5!” -DeleteContent
Example in action-
Additional search properties to refine the query-
Although the table focuses more on emails rather than calendar meetings or appointments, it can be used all the same.
|Message sent to Ben Smith|
|Messages with Graham Smith in the Cc field.|
|Messages sent by Matt Hays|
|Keywords in retention policy||retentionpolicy:business critical||Messages that have the Business Critical retention tag applied.|
|Time received between range||received:”2018/01/01 10:00:00..2018/02/01 13:00:00″
||Meeting is from 01/01/2018 to 01/02/2018|
|Sent||sent:yesterday||All messages sent yesterday.|
|Subject||Subject:”conference”||All messages where the phrase “conference” appears in the Subject field.|
|Attachments||attachment:report.pptx||Messages that have an attachment named report.pptx. The use of attachment:report or attachment:rep* returns the same results + anything else starting with “rep”|
Hope this is helpful!
Further reading – Useful Exchange PowerShell Commands – The Ultimate List.