Search-Mailbox kind Advanced Query Syntax AQS

This post is also available in: Polish


While you are using Search-Mailbox to find, delete or to copy items from mailbox you can use Advanced Query Syntax parameter to define what kind of items you are looking for.

Advanced Query Syntax  helps users to better define and narrow their searches.

Following AQS parameters we can use to narrow search:

  • File kinds: folders, documents, presentations, pictures and so on.
  • File stores: specific databases and locations.
  • File properties: size, date, title and so on.
  • File contents: keywords like “project deliverables,” “AQS,” “blue suede shoes,” and so on.


For Exchange Search-Mailbox CMDlet we can easily use following parameters from File kinds:

File Type:   Example 
 Contacts kind:contacts
 E-mail kind:email
 Instant Messenger conversations kind:im
 Meetings kind:meetings
 Tasks kind:tasks
 Notes kind:notes

Below we present few examples of using AQS parameter to find specified items in mailbox.

Before using those examples, first run it with -EstimateResultOnly. Then you will get only informations about results of this Search Query

Search-Mailbox -identity JSmith -SearchQuery "kind:meetings" -EstimateResultOnly


All Advanced Query Syntax parameters list can be found here:

Advanced Query Syntax



Delete all calendar items from JSmith mailbox:

Search-Mailbox -identity JSmith -SearchQuery "kind:meetings" -DeleteContent -Force


Delete all emails from JSmith mailbox sent to distribution group “Test_DistributionGroup:

Search-Mailbox -Identity JSmith -SearchQuery "to:Test_DistributionGroup" -DeleteContent -Force


Delete all emails from JSmith mailbox:

Search-Mailbox –identity JSmith –SearchQuery "kind:email" –DeleteContent


Delete all contacts from JSmith mailbox:

Search-Mailbox –identity JSmith –SearchQuery "kind:contacts" –DeleteContent



Print Friendly
Tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>