In this tutorial i will be shpwing you how to delete an email from anyone’s or everyone’s mailbox in Office 365 using Microsoft 365 Compliance Centre and PowerShell.
You will learn how to search for the email, and delete the email from all users mailboxes using powershell.
Updated: This is now a video post.
The Script – UPDATED 2023 (Use new Script Below)
If you already have the Exchange Online Management Module installed, please update it before running the script by opening an elevated PowerShell window and using the following cmdlet
Update-Module -Name ExchangeOnlineManagement
# Get Microsoft 365 login credentials
#Connect To Security and Compliance Powershell
New-ComplianceSearchAction -SearchName "Search Name" -Purge -PurgeType HardDelete
#Change HardDelete to SoftDelete if you wish to test first, Soft Delete will store the email in users 'Recoverable items' folder
#EdTech Network Manager, experienced in Microsoft 365, Server 2019, Intune, SCCM and anything inbetween.