jdgregson / o365utils

Utilities to administer Office 365 and Exchange Online via PowerShell.
GNU General Public License v3.0
38 stars 8 forks source link

Delete items limited to 10? #7

Open Rai80 opened 5 years ago

Rai80 commented 5 years ago

I tried the script today, but seems like the Purge is limited to 10 items.

https://docs.microsoft.com/en-us/powershell/module/exchange/policy-and-compliance-content-search/new-compliancesearchaction?view=exchange-ps

A maximum of 10 items per mailbox can be removed at one time. 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 action isn't intended to clean up user mailboxes.

jdgregson commented 5 years ago

I wasn't aware of this limitation, thanks for bringing it to my attention. I intended for this to be an incident response tool, so I haven't encountered a situation where there were more then 10 items in a single mailbox.

As this is an intentional limitation on Microsoft's end, it will be difficult to work around. In the short term I should add a warning if more than 10 items are found in a single mailbox. In the long term I may be able to refactor it so that it will loop over mailboxes with more than 10 results and delete them 10 at a time.