Clean/Purge an Exchange Online Mailbox using PowerShell - Post 1st July 2020

≯℡__Kan透↙ 提交于 2021-01-29 05:11:42

问题


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 joe.bloggs@domain.com -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:


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



来源:https://stackoverflow.com/questions/62675851/clean-purge-an-exchange-online-mailbox-using-powershell-post-1st-july-2020

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!