In the previous recipe, we looked at how we can use the Search-Mailbox cmdlet together with the -DeleteContent parameter to search for and delete e-mail messages from mailboxes in our environment. Although we can still use this method in Exchange 2016, the new New-ComplianceSearch and New-ComplianceSearchAction cmdlets can be used instead of Search-Mailbox to delete messages.
Why use these new cmdlets instead of using Search-Mailbox? With this cmdlet, we are limited to searching a maximum of 10,000 mailboxes per single search. On the other hand, New-ComplianceSearch has no such limitations, allowing large organizations to easily perform organization-wide searches and delete operations.
However, a maximum of 10 items per mailbox can be deleted in one go using the new cmdlets. This is because New-ComplianceSearch was designed...