Skip to content

Search and Delete specific email for all or specific users using PowerShell.Exchange 2010

Search and Delete specific email for all or specific users using PowerShell.

 

In many cases an Exchange Administrator will get a request to delete an email which was sent to a specific user or to multiple users. Exchange allows us to do this with a feature called search-mailbox, this feature can be used to search all mailboxes in the organization using the subject line or simple search for emails with a specific sentence in the body of the email.

 

To start the we first need to provide an Exchange Administrator the needed permissions to search and delete emails across the Exchange organization, to provide the needed permissions we need to run the following cmdlets.

 

Note: By default and Administrator is not a member of the “Discovery Management” group.

 

Next we need to create a new Management Role assignment and add the administrator user to the Mailbox Import and Export role. This can be completed by running the following cmdlet:

 

Before we can continue to bulk delete the email from all mailboxes, we can run the following cmdlet to create a log only to verify how many emails will be deleted.

 

The Administrator will receive an email with the search results.

Final step would be to run the cmdlet with the -deletecontent parameter to delete all emails matching the search query.

 

After the script has completed successfully, the following output will be presented with the number of items which was deleted during the “-DeleteContent” process.

 

That is how you can quickly find and remove an email message  across the exchange organization.

TechNet Article : https://technet.microsoft.com/en-us/library/dd298173.aspx

 

 

#ThatLazyAdmin

 

Sharing is caring!

Published inExchange 2010

Be First to Comment

Leave a Reply

Your email address will not be published.