How to delete messages using Search-Mailbox in Exchange Server 2010

Share this:

Hi Folks,

In some cases the administrator may want to delete content of a mailbox located in Exchange Server 2010. The first step is to create the search query that you want to use and you can use your own Outlook to get the string right. In the following example we are making sure that any message sent or received prior to 01-January-2012 and if the results are the expected you can save the query.


The second step is to use the Search-Mailbox and use the string that we tested above with the –SearchQuery attribute and –DeleteContent. The syntax is described below and also the cmdlet in action is shown in the figure below.

Search-mailbox –Identity <Mailbox> -SearchQuery "received:<01/01/2012 and sent:<01/01/2012" –DeleteContent


Note: If the Search-Mailbox is not available for your current user. Please, logged as Organization Management member run the following cmdlet New-ManagementRoleAssignment –Role “Mailbox Import Export” –User <Mailbox> and then close the Exchange Management Shell and open it again.

Anderson Patricio (Portuguese)
Twitter: @apatricio

Written by Anderson Patricio

Anderson Patricio is a Canadian Exchange Server MVP and MCSM (Solutions Master) and he contributes to the Microsoft Community with articles, tutorials, blog posts, forums and book reviews. He is a regular contributor at, and (Portuguese).