How to Delete a Specific Email from All Mailboxes in Exchange Online (Compliance Search & Purge Guide)

When a phishing campaign, malware attachment, or misdirected confidential email lands in user mailboxes across your tenant, administrators need a fast, auditable way to search and purge that message organization-wide.

Important Deprecation Notice: The legacy Search-Mailbox -DeleteContent cmdlet has been retired in Exchange Online. Modern Microsoft 365 tenants must use Microsoft Purview Content Search (New-ComplianceSearch and New-ComplianceSearchAction -Purge) via Security & Compliance PowerShell (Connect-IPPSSession), or Microsoft Defender for Office 365 Threat Explorer (for Defender P1/P2 licensed tenants).

Purview Email Search & Purge Workflow

Microsoft 365 Content Search & Email Purge Runbook 1. Purview RBAC Assign admin to: • eDiscovery Manager • Search And Purge Required to run -Purge 2. Connect IPPS Open Security & Compliance session: Connect-IPPSSession 3. Create & Run Search Scope with KQL: New-ComplianceSearch Start-ComplianceSearch Verify hit count first! 4. Purge Messages Execute Soft/Hard Delete action: New-ComplianceSearchAction -Purge -PurgeType SoftDelete 10-Item Per Mailbox Limit: New-ComplianceSearchAction -Purge deletes a maximum of 10 items per mailbox at a time. Re-run if a mailbox has >10 matches.

Step 1: Assign Required Purview Permissions

Even Global Administrators cannot purge email without explicit Purview eDiscovery permissions:

  1. Open the Microsoft Purview portal (purview.microsoft.com) > Settings > Roles and scopes > Permissions > Microsoft Purview solutions > Roles.
  2. Add your admin account to:

- Organization Management (or eDiscovery Manager) - Search And Purge (required specifically for -Purge)

Allow up to 30 minutes for newly assigned Purview RBAC roles to take effect.


Step 2: Connect to Security & Compliance PowerShell

POWERSHELL
Import-Module ExchangeOnlineManagement
Connect-IPPSSession -UserPrincipalName admin@lab365.in

Use Keyword Query Language (KQL) to target the exact sender, subject, and date range so you do not accidentally remove legitimate mail:

POWERSHELL
$SearchName = "Phish-Purge-$(Get-Date -Format 'yyyyMMdd-HHmm')"

New-ComplianceSearch -Name $SearchName `
    -ExchangeLocation All `
    -ContentMatchQuery '(From:"[email protected]") AND (Subject:"Urgent Wire Transfer") AND (Received>=2026-11-16)'

Start-ComplianceSearch -Identity $SearchName

Poll the search status until Status equals Completed, then inspect the Items count and SuccessResults before purging:

POWERSHELL
do {
    Start-Sleep -Seconds 10
    $Status = Get-ComplianceSearch -Identity $SearchName
    Write-Host "Search Status: $($Status.Status) | Items Found: $($Status.Items)"
} while ($Status.Status -ne "Completed")

$Status | Select-Object Name, Status, Items, Size, SuccessResults

Step 4: Purge the Matched Emails

Once you have verified the search hit count is accurate, run New-ComplianceSearchAction -Purge:

  • SoftDelete: Moves items to the user's Recoverable Items\Deletions folder (recoverable by admins within the retention window).
  • HardDelete: Moves items to Recoverable Items\Purges (unrecoverable by users; permanently purged when Single Item Recovery/retention expires).
POWERSHELL
New-ComplianceSearchAction -SearchName $SearchName `
    -Purge `
    -PurgeType SoftDelete `
    -Confirm:$false

Monitor the purge job until completion:

POWERSHELL
Get-ComplianceSearchAction -Identity "$($SearchName)_Purge" |
    Select-Object Name, Status, Results

Note for On-Premises Exchange Server SE / 2019

If you are purging messages on an on-premises Exchange Server SE or 2019 database rather than Exchange Online, Search-Mailbox remains available in the Exchange Management Shell after assigning the Mailbox Import Export role:

POWERSHELL
New-RoleGroup "Mailbox Purge Admins" -Roles "Mailbox Import Export"
Add-RoleGroupMember "Mailbox Purge Admins" -Member "exchadmin"

Get-Mailbox -ResultSize Unlimited |
    Search-Mailbox -SearchQuery 'From:"[email protected]" AND Subject:"Urgent Wire Transfer"' `
        -DeleteContent -Force -LogLevel Full `
        -TargetMailbox "AdminMailbox" -TargetFolder "PurgeLogs"

💬 Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.