I wrote this article to show how to delete a specific email from all mailboxes using a PowerShell cmd on Microsoft Exchange server 2010 / 2013 / 2016.

Below is the Command for 2016 and also can work on MS Exchange 2010 and 2013
The first thing is we must have to add admin account into two security roles/groups ( Mailbox Import Export role and Discovery Management)

For adding an admin account to the Mailbox, Import Export Role we will run the cmdlet below mentioned:

New-Managementroleassignment –Role "Mailbox Import Export" –User "Administrator"

Now we will have to open an Active Directory Users And Computer for adding Admin account to the Discovery Management Group.

For testing purpose, I have an email called “Phishing Mail” In Inbox which we are about to delete.

For deleting all emails with the specific word “Phishing Mail” In the subject We run the cmdlet below mentioned:

Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery "Subject:Phishing Mail" -DeleteContent

we can see the email has been gone (deleted and also it has been deleted from the deleted items as well).

By admin

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *