Jump to content

Recommended Posts

Posted

We have had an incident with emails and tasked with deleting not only the specific emails from all student mailboxes, but also any other email chains that it was forwarded to or used to create a new email chain. We have created a search in the Compliance Centre and it returns all the emails we want to delete. We have also been given these commands by Microsoft, to be run in this specific order:

1.
Set-Mailbox -Identity "[email protected]" -SingleItemRecoveryEnabled $false

2.
For($i=1;$i -lt 100;$i++){do{New-ComplianceSearchAction -SearchName gym -Purge -PurgeType HardDelete -Confirm:$false -Force;Sleep 2}While($i -ge 100)}

3.
Start-ManagedFolderAssistant -Identity "[email protected]" -FullCrawl

However, we are having issues with errors being thrown:

Write-ErrorMessage : |Microsoft.Exchange.Configuration.Tasks.ThrowTerminatingErrorException|Unable to execute the task. Reason: Compliance search initialization for "gym_Purge" failed with exception: Your request can't be started because the maximum number of     jobs for your organization are currently running. Please wait for other jobs to complete and then try again..                                                                                                                                                           At C:\Users\xxxxxxxx\AppData\Local\Temp\tmpEXO_0yr4iaex.uv1\tmpEXO_0yr4iaex.uv1.psm1:1191 char:13                                                                                                                                                                  +             Write-ErrorMessage $ErrorObject                                                                                                                                                                                                                           +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                               + CategoryInfo          : WriteError: ( [New-ComplianceSearchAction], ThrowTerminatingErrorException                                                                                                                                                                  + FullyQualifiedErrorId : [TimeStamp=Fri, 09 Feb 2024 11:27:15 GMT],Write-ErrorMessage

 

We've had success with this before, but we think that was because it was a relatively small amount of emails. However, due the sheer amount we are trying to delete this time, we think we are being rate limited and it's failing.

 

Has anyone successfully deleted a lot of emails from a lot of mailboxes? If so, how did you do it?

Posted

The clue is in the error message :)

using a sleep is generally a bad way to do this, ideally the 2n'd command should try and read the output and check the job is completed.

I'm not good enough with ps to do that, so try increasing the sleep.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...