Jump to content

Recommended Posts

Posted

So... following on my other topic.. 

 

I'm trying to remove this email from everyones inbox and having issues with powershell commands. 

 

Quote

New-ComplianceSearchAction: |Microsoft.Exchange.Management.Tasks.ComplianceJobTaskException|Unable to execute the task. Reason: The search
"Name" is still running or it didn't return any results. Please wait until the search finishes or edit the
query and run the search again.

 

I've done the search using the website of exchange and that looks to be finished. But when i go to run the delete command like above i get this error. 

 

What am i doing wrong here?

 

Posted (edited)

It's a pain I had to do a new Compliance-Search - I'm sure there's a GUI for it as well as we are just A1 and have access - in the MS security portal (purview?)  under Ediscovery

 

I did a Compliance Search for the subject and also put a date range in to speed it up a lil.

Once the Search was done I could then run a powershell script against Exchange Online to delete the mail based on the compliance search for all mailboxes.

Of course check the results of the compliance search to make sure it hasn't returned all mails.

 

It's not a very intuitive process at all and I was having issues with things randomly not working, but this is typical Microsoft. I remember there was a bug the same as yours with results saying they hadn't finished when they had. It's a bug but I don't remember any more sorry it's been months since I last did one, every time it crops up I have to google how to do it to find out MS have changed it slightly !

Edited by mikes
Posted (edited)

Sometimes you have to start the search in PowerShell even though you started it in Purview, should show you the status of running searches, or it sometimes only works if the search is created in PowerShell like you said

 

I just pasted this from a template I use but Get-ComplianceSearch might help

New-ComplianceSearch -Name "deletetheseemails" -ExchangeLocation All -ContentMatchQuery "(From:[email protected]) AND (Date>2026-07-13) AND (Recipients:[email protected])"

Get-ComplianceSearch -Identity "deletetheseemails" | FL name,items,size,jobprogress,status

Start-ComplianceSearch deletetheseemails

Get-ComplianceSearch -Identity "deletetheseemails" | FL name,items,size,jobprogress,status

New-ComplianceSearchAction -searchname "deletetheseemails"  -Purge -PurgeType HardDelete

or SoftDelete

Get-ComplianceSearchAction deletetheseemails | fl

and so on

 

 

Edit: if its internal I always tell them to recall it as so much faster and they get a nice automated report of the recall status.

Edited by robintech

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...