How to delete emails from Mailbox using Exchange PowerShell

Go to Exchange Management Shell

Use following Command

How to delete emails by Subject line

Search-Mailbox -Identity "Test@123.com" -SearchQuery 'Subject:"Your Subject"' –DeleteContent

Confirm with Yes

In status PS will show you result count and Size of total deletion



 

How to delete emails by from

In status PS will show you result count and Size of total deletion  

Search-Mailbox -Identity "Test@123.com" -SearchQuery 'Subject:"123@ABC.com"' –DeleteContent



You also can delete all email from specific @domain from identified mailbox (Your Mailbox) by putting @Domain.com only

Search-Mailbox -Identity "Test@123.com" -SearchQuery 'Subject:" @ABC.com"' –DeleteContent

Comments

Popular posts from this blog

How to check when Sharepoint List was created using PowerShell.

How to connect SharePoint online with SharePoint designer 2013

Unable to add SMTP address in Office365 (Detailed error message: Unable to update the specified properties for on-premises mastered Directory Sync objects or objects currently undergoing migration. )