Delete calendar meetings in a Mailbox using PowerShell – Exchange

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

Delete all-

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

More on KQL query language

Example in action-

Powershell Calendar

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.

Property Example Search results
To to:”Ben Smith”
to:bsmith
to:besmith@contoso.com
Message sent to Ben Smith
Cc cc:Graham Smith
cc:Smithg
cc:Smithg@contoso.com
Messages with Graham Smith in the Cc field.
From from:Matt Hays
from:Matth
from:Matth@contoso.com
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″

  • YYYY-MM-DDThh:mm:ss
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.


Thanks for reading – feel free to follow and stay updated 🙂  View sysadminguides’s profile on Facebook View GuidesSysadmin’s profile on Twitter View 115372466162675927272’s profile on Google+

 

4 thoughts on “Delete calendar meetings in a Mailbox using PowerShell – Exchange

  1. Pingback: How to / Fix – Delete recurring meetings using PowerShell – Exchange Mailbox | Windows SysAdmin Hub

  2. Pingback: Useful Exchange PowerShell Commands – The Ultimate List. | Windows SysAdmin Hub

  3. I often visit your site and have noticed that you don’t update it often. More frequent updates
    will give your website higher authority & rank in google.
    I know that writing posts takes a lot of time,
    but you can always help yourself with miftolo’s tools which will shorten the time of creating an article to a couple of seconds.

    Like

  4. I have noticed you don’t monetize your blog, don’t waste your traffic,
    you can earn extra cash every month. You can use the
    best adsense alternative for any type of website (they approve
    all websites), for more details simply search in gooogle: boorfe’s tips monetize your website

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s