Remove-ComplianceSearchAction no longer working

Copper Contributor

I have a script that performs a search on all our Exchange Online mailboxes for a string and deletes any emails containing that string. To do this, I create a Compliance Search and the an associated Compliance Search Action.

 

The script cleans up after itself by using Remove-ComplianceSearch and Remove-ComplianceSearchAction. The former works fine, but the latter command has started to fail in the last couple of weeks.

 

If I run GetComplianceSearchAction it will return (e.g.) 

 

Name                                             SearchName                                 Action
----                                             ----------                                 ------
SEARCHNR2DLPVXPaddles12Races_Purge               SEARCHNR2DLPVXPaddles12Races               Purge
SEARCH4051428013Par!Offends_Purge                SEARCH4051428013Par!Offends                Purge
SEARCH40269400670LinksMonochromatic$_Purge       SEARCH40269400670LinksMonochromatic$       Purge
SEARCH402387051^Courses92Bolts_Purge             SEARCH402387051^Courses92Bolts             Purge
SEARCHYCQAI3AC78^ReplaceUntied_Purge             SEARCHYCQAI3AC78^ReplaceUntied             Purge
SEARCH405194894Overtaking#77Discographies_Purge  SEARCH405194894Overtaking#77Discographies  Purge
SEARCH403844459&ApologizesFrequencies13_Purge    SEARCH403844459&ApologizesFrequencies13    Purge

 

But running Remove-ComplianceSearch on (e.g.) "SEARCHNR2DLPVXPaddles12Races_Purge" returns an" error "The compliance search object "SEARCHNR2DLPVXPaddles12Races" cannot be found.

 

This was all working fine until very recently. Has something changed in the ExchangePowerShell module? How can I make the script see the purge action?

1 Reply
Just tried doing a Remove-ComplianceSearch in one of our old tenants, no issues there... Are you still facing this issue in your tenant now?