Share via


delete emails Greater Than 10,000 Messages

Question

Wednesday, July 18, 2018 7:49 AM

When i run the below syntax i am able to delete emails but not all the emails as mailbox has millions of emails.Search-mailbox cmdlet retruns only 10000 results. please help me with  new-mailboxsearch cmdlet syntax

[PS] C:\Windows\system32>Search-Mailbox "[email protected]" -SearchQuery "Received:01/01/2013..12/31/2015 AND kind:email" -DeleteContent -Force
WARNING: The Search-Mailbox cmdlet returns up to 10000 results per mailbox if a search query is specified. To return
more than 10000 results, use the New-MailboxSearch cmdlet or the In-Place eDiscovery & Hold console in the Exchange
Administration Center.

All replies (5)

Thursday, July 19, 2018 9:40 AM ✅Answered

Hi,

New-MailboxSearch command couldn't delete the emails, if we could to delete more than 10,000 messages, we still need to use search-mailbox, a theoretical method is to run the command many times with different date ranges. 

Or we need to write a script to realize this:

Here are an example and you may get a start from here:

Exchange Search-Mailbox Delete More Than 10,000 Items

Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.

Regards,

Manu Meng

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].

Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Wednesday, July 18, 2018 8:28 AM

will the below syntax work

New-MailboxSearch -Name "mysearch" -SourceMailboxes [email protected] -SearchQuery "Received:01/01/2013..12/31/2015 AND kind:email" -DeleteContent -Force


Wednesday, July 18, 2018 2:29 PM

Check out these articles

Search, Recover, Export Mailboxes, Folders, Email, Contacts, Calendars, Tasks, etc. from Offline Exchange Databases (EDBs), On-Premise Exchange Servers and Office 365. Migrate/Recover direct from any offline EDB into any On-Premises Exchange Server, even cross version i.e. 2003 → 2007 → 2010 →2013 → 2016 → Office 365 with Lucid8's DigiScope


Wednesday, July 18, 2018 6:20 PM

plz help me with the syntax as i have millions of emails to delete and i dont have any test environment


Wednesday, July 18, 2018 6:36 PM

Each of those articles has example syntax so I would suggest you start there, since we cannot write it for you.  If you want an easy to understand graphical interface method I would use our DigiScope product

Search, Recover, Export Mailboxes, Folders, Email, Contacts, Calendars, Tasks, etc. from Offline Exchange Databases (EDBs), On-Premise Exchange Servers and Office 365. Migrate/Recover direct from any offline EDB into any On-Premises Exchange Server, even cross version i.e. 2003 → 2007 → 2010 →2013 → 2016 → Office 365 with Lucid8's DigiScope