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
Refined 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
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.|
|Date when messages expire according to policy||expires:4/2/2014||Messages that expire on April 2, 2014.|
|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!