Hi Rob Murr
Thank you for posting your question in Microsoft Q&A.
Based on your description, I understand you are encountering a "Target mailbox is out of space" error when using the Search-Mailbox cmdlet to clear the Recoverable Items folder for large mailboxes as part of your Exchange 2016 to 2019 migration.
This error message is literal, but it does not refer to the user mailbox you are trying to clean. The storage limit that has been exceeded pertains to the target mailbox specified in your script, in this case, the "Discovery Search Mailbox".
Here are some recommendations you can try:
Option 1: Skipping the copy step
The reason I recommended skipping the copy step is because the error you're encountering isn't related to the user mailbox, it’s due to the Discovery Search Mailbox quota. Even if user mailboxes have unlimited storage, the Discovery mailbox typically has a fixed limit (usually 50 GB). When large Recoverable Items folders are copied into it, it quickly fills up and causes failures.
If your goal is simply to reduce mailbox size before migration, there's no need to copy the data elsewhere. You can delete it directly from the Recoverable Items folder using this simplified command:
Search-Mailbox -Identity "User Name" -SearchDumpsterOnly -DeleteContent
It goes straight to the Recoverable Items folder which is where deleted items are stored behind the scenes and permanently deletes everything in there. It doesn’t touch the Discovery mailbox at all, so you won’t run into any quota limits or errors related to that.
The Recoverable Items folder isn’t something users see or interact with directly. It’s mainly used for retention policies or legal holds. So, if you’re not required to keep that data for compliance reasons, deleting it is a quick and safe way to reduce mailbox size before migration.
Option 2: Recommended Solution for Exchange 2016/2019 (Use Compliance Search)
The Search-Mailbox cmdlet is considered a legacy tool. For Exchange 2016 and later, the recommended method is to use the more powerful and scalable Compliance Search cmdlets. This modern approach does not require a target mailbox to store results before deletion, thereby avoiding the quota issue entirely.
New-ComplianceSearch (ExchangePowerShell) | Microsoft Learn
I hope this information is helpful. And of course, if you have any additional concerns, feel free to comment below.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.