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

0
196
views

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!

Previous articleNew Exchange 2016 Mobile Device Mailbox Policy
Next articleExchange Online Backup and Restore: A Complete Guide
About Me ? I Guess i would start by saying i am a family guys and full time SysAdmin and Tech Junky. This Blog is my first attempt to share information about daily issues i come across as a SysAdmin as well as some new deployments i am part of. Topics that i will cover will mostly be about Office 365,Windows,Exchange as well as Active Directory. I hope some of my Blog posts helps someone #LiveLongAndBeLazy #Exchange #Office 365 #ActiveDirectory #Hyper-V
SHARE

LEAVE A REPLY

Please enter your comment!
Please enter your name here