PowerShell Code: Delete Specific Email from All Mailboxes In Exchange

In this PowerShell code, I’ll show you how to delete all emails from a specific sender address from all Exchange mailboxes in the organization.

Before you start you will need to add your account to the “Discovery Management” role group.

Run the code below from Exchange Shell and add the email address (from) of the sender.

Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery "From:email@emailaddress" -DeleteContent

Posted

in

by