AndersonPatricio.ca

A Microsoft Unified Communications resource blog

Recent Posts

Search by Topic

Email Notifications

Blogroll

My Microsoft KBs

.:. About me..

Microsoft Community

Andy's Toolbox

Archives

Ads

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

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.

image

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

image


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.

Cheers,
Anderson Patricio
http://www.andersonpatricio.ca
http://www.andersonpatricio.org (Portuguese)
Twitter: @apatricio

Comments

sahil said:

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

# January 29, 2013 12:55 PM

sahil said:

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

# January 29, 2013 12:56 PM

sahil said:

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

# January 29, 2013 12:56 PM

sahil said:

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

# January 29, 2013 12:56 PM
Leave a Comment

(required) 

(required) 

(optional)
 

(required) 

If you can't read this number refresh your screen
Enter the numbers above: