Monday 29 March 2021

How to Search and delete an email from a mailbox in exchange server 2016

Environment:

Have exchange 2016 hybrid environment with office 365.

Issue:

A phishing email received to a user and need to be deleted from his mailbox ASAP.

Solution:

Run the following command to delete the email from a mailbox

Search-Mailbox -identity nawazabc -SearchQuery 'Subject:"SubjectOfTheEmail"' -TargetMailbox nawazxyz -TargetFolder "inbox\spamitems" -LogLevel full -DeleteContent

Run the following command to delete the email from the mailbox DataBase

Get-Mailbox -ResultSize unlimited -Database "db1"|Search-Mailbox -SearchQuery 'Subject:"SubjectOfTheEmail"' -TargetMailbox nawazxyz -TargetFolder "inbox\spamitems" -LogLevel full -DeleteContent

To search and delete such emails from Office 365 please look  into this link https://nawazblogger.blogspot.com/2020/07/how-to-search-and-delete-email-from.html 


Get-Mailbox -ResultSize unlimited -Database "db1" | Search-Mailbox -SearchQuery 'Subject:"Security Awareness Module Assigned "Full Social Media Policy""' -deleteContent


No comments:

Post a Comment