none
Removing/Deleting Messages from mailboxes in Exchange 2010 SP1

    Question

  • 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,

    Stephen

    Thursday, November 04, 2010 8:47 PM

Answers

All replies

  • Does this help?

    http://msexchangeteam.com/archive/2010/10/27/456739.aspx

     


    Tim Harrington - Catapult Systems - http://HowDoUC.blogspot.com
    Thursday, November 04, 2010 8:53 PM
  • Tim,

    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?

    Thanks,

    Stephen

    Thursday, November 04, 2010 9:03 PM
  • Check this one...Section "Advanced Export Mailbox Request Commands"

    http://www.msexchange.org/articles_tutorials/exchange-server-2010/management-administration/look-import-export-mailbox-improvements-exchange-2010-service-pack-1-part2.html

     


    Tim Harrington - Catapult Systems - http://HowDoUC.blogspot.com
    Thursday, November 04, 2010 9:19 PM
  • 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

     

     


    lAdK
    blog | twitter
    Thursday, November 04, 2010 10:07 PM
  • And please note, if you want to run the cmdlet Search-Mailbox with parameter -DeleteContent, you must also be assigned the "Mailbox Import Export" Role. By default, the "Mailbox Import Export" role isn't assigned to any role group.

    How to Add a Role to a User or USG


    Frank Wang
    Tuesday, November 09, 2010 3:10 AM
  • 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 msexchangeteam.com 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"?

    Tuesday, November 09, 2010 1:33 PM
  • yes attachment name is possible using the 

     

    get-mailbox -resultsize unlimited | search-mailbox -SearchQuery "attachment:report.xlsx" -DeleteContent

     

    more info http://technet.microsoft.com/en-us/library/bb232132.aspx

     



    lAdK
    blog | twitter
    • Proposed as answer by emma.yoyo Wednesday, November 10, 2010 2:45 AM
    • Marked as answer by slammers25 Wednesday, November 10, 2010 1:27 PM
    Tuesday, November 09, 2010 1:42 PM
  • All,

    I need to remove messages from multiple Exchange 2010 SP1 mailboxes, but using  "get-mailbox -resultsize unlimited | search-mailbox -SearchQuery "Subject:'whatever'" -DeleteContent" is not giving me the flexibility to remove messages from particular period.

    Includding I'm also trying to export message to a mailbox.

    Any idea. 

    Zahir Hussain Shah Infrastructure Practice Consultant My blog: http://zahirshahblog.com
    Sunday, July 03, 2011 8:57 AM
  • I am having the same issue - Exchange 2010 SP1 and get-mailbox -resultsize unlimited | search-mailbox -SearchQuery "Subject:'whatever'" -DeleteContent" is not working for me.

    Anyone - any ideas?

    Friday, December 28, 2012 1:08 AM
  • Not sure about the rest... but it looks like "attachment:'*'" works to find "any" attachment in the search query part, or you can put in a specific document name.

    BYoung, Sr. Server Analyst

    Tuesday, April 30, 2013 3:08 PM
  • Hi,

    How to delete specific period mails from single mailbox.

    Regards,

    Mahesh

    Friday, September 20, 2013 11:27 AM
    1. You can use the MS tools by following this link http://windowsitpro.com/exchange-server-2010/search-destroy-email-content-exchange-2010
    2. Or is you want something a bit more intuitive check out Lucid8's DigiScope http://www.lucid8.com/product/digiscope.asp

    Search, Recover, & Extract Mailboxes, Folders, & Email Items from Offline Exchange Mailbox and Public Folder EDB's and Live Exchange Servers or Import/Migrate direct from Offline EDB to Any Production Exchange Server, even cross version i.e. 2003 --> 2007 --> 2010 --> 2013 with Lucid8's DigiScope

    Saturday, September 21, 2013 12:41 AM
  • Hello Zahir

    Do you find a way to remove mails for a period of time? For a specific date and for a specific subject I can able to delete them as seen below

    get-mailbox -identity User1 -resultsize unlimited |  search-mailbox -SearchQuery "subject:""Me too added connections you may know""  Sent:08/13/2012" -TargetMailbox user2 -TargetFolder Inbox –LogOnly  -LogLevel Full

    Regards


    LMS

    Wednesday, August 13, 2014 7:40 AM