Removing/Deleting Messages from mailboxes in Exchange 2010 SP1

  • Thread starter slammers25
  • Start date Views 3,386
Not open for further replies.


Does anyone have a how to guide or a blog they can point me to that shows how to remove/delete an email based on keyword in subject field or body or even attachment name? We have Exchange 2010 SP1. From what I understand there is a new command for handling this... The typical scenario would be running this against multiple mailboxes.

I'm coming from Exchange 2003 so Exmerge was my friend. :)





Thanks for the link but it says in that article:

In Exchange 2010 RTM and Exchange 2007, you can use the Export-Mailbox cmdlet to export or delete messages. In Exchange 2010 SP1, the functionality to export a mailbox is provided by the New-MailboxExportRequest cmdlet and is covered in a separate article.

Anyone seen that one yet? or have another?




1. add the user you are going to use to the AD group " Discovery Management"

2. Logon as this user and run EMS

3. get-mailbox -resultsize unlimited | search-mailbox -SearchQuery " Subject:'whatever'" -DeleteContent

blog | twitter


With the search-mailbox command can you also search out and delete any email based on attachment name? Reading another forum post on this, there is discrepancy on this specific point.

In times past, we've had issues where HR accidentally sends payroll information in a spreadsheet to the wrong people. They want us to do a search and destroy based on attachment name.

Here are comments from the article mentioned earlier from TW...just wanted to get this question ironed out...
Bharat Suneja [MSFT] said:

@Daniel: As mentioned in the post, you can use the Search-Mailbox cmdlet, which has the -DeleteContent switch. See Use Mailbox Search to Delete Messages.
October 28, 2010 6:47 PM
Anthony said:

Can you document which property keywords are available to Search-Mailbox? I am trying to delete all messages that do not have attachments and hasattachment:false, hasattachment:no, hasattachments:no, isattachment:false, and isattachment:no do not work.
October 28, 2010 7:19 PM
Bharat Suneja said:

@Anthony: You can use keywords supported by Exchange Search. See Understanding Exchange Search for a list. The HasAttachmentkeyword isn't one of them.
If you use unsupported keywords in SearchQuery, you'll get an error stating The property keyword isn't supported.
October 29, 2010 4:01 PM
Andrew phillips said:

@Bharat: The link you provided on Enderstanding Exchange Search shows this example:
From:" April Stewart" HasAttachments:true Subject:Contoso.
Is the example wrong or perhaps misleading in showing the use of " HasAttachments" ?
Not open for further replies.