0
votes

On 1st July 2020 Microsoft have retired the Search-Mailbox cmdlet. This functionality allowed for the purging of all content in a mailbox e.g.

Search-Mailbox -Identity [email protected] -DeleteContent

The above functionality worked great, however it has been retired. The recommended way forward is to use New-ComplianceSearch, Start-ComplianceSearch and New-ComplianceSearchAction. This seems all good until you read the documentation at https://docs.microsoft.com/en-us/exchange/policy-and-compliance/ediscovery/delete-messages?view=exchserver-2019 which has this killer line

A maximum of 10 items per mailbox can be removed at once. Because the capability to search for and remove messages is intended to be an incident-response tool, this limit helps ensure that messages are quickly removed from mailboxes. This feature isn't intended to clean up user mailboxes.

I cannot find a way to clean/purge a mailbox now.

Does anyone know of any new PowerShell cmdlets or ways of using existing ones that will allow the complete purging of an Exchange Online mailbox given an Identity (email address)?

1
I don't quite get why you'd want to do this to begin with...notjustme
I build a migration product. Its useful to be able to clean down a mailbox and re-use it for testing etcMatt

1 Answers

0
votes

New-ComplianceSearchAction can handle 10 email purges at a time. So, you have two options as I can think of

  1. Loop through many cycles of New-ComplianceSearchAction -Purge -PurgeType HardDelete
  2. Apply Retention Policy to the selected mailboxes in which the policy can delete all emails before 'x' number of days

Thanks, Manu