365 Delete Malicious Content - Hunt Status Code 400

 


When you access your 365 Exchange mail trace and run a query it will show the “Go Hunt for this message” option.

    

However if you don’t have the proper Microsoft Defender Licensing it appears to fail the hunt:


For a more manual FREE method of clear those messages out such as the one in the image below we can use the Compliance Features.

From Admin Centers Open Compliance:


Content Search:


Name and Description (Shorter name is easier for script later)

 

I am only removing from Exchange in this instance:




 I selected Query Build so I can customize for my query:



 Confirm/Submit:



You can monitor it from the Content Search and open it once status is complete:

 

Double click to open the results:


Reminder: If your query legitimate or not contains more than 10 emails per mailbox or more that 50,000 mailboxes this will not work! If you have more than 10 it may only delete the first 10 it finds. If you run it over and over again it still won’t remove any more. This tool is ONLY for surgical removal of a single email blast.

Now you need to open Powershell to connect to 365:

Import-Module ExchangeOnlineManagement

Then run the following command:

Connect-IPPSSession -UserPrincipalName <UPN>



Then run the following to purge the data found

New-ComplianceSearchAction -SearchName "Named Query" -Purge -PurgeType SoftDelete


Then you can go to one of the users and confirm the email was deleted and in their OWA deleted recoverable items.

 

 

 

Connect to Security & Compliance PowerShell | Microsoft Learn

 

 

 

Comments

Popular posts from this blog

FRS to DFSR Post Cleanup “File Replication NtFrs Stopped”

Domain Migration SubinACL /Migratetodomain How To:

How to configure HP LaserJet Printer IPsec Encryption