Author: Zahir Hussain Shah
Tags: Delete one email from all users mailboxes on Exchange 2010 SP1, Remove emails from Exchange 2010 SP1 Users using Exchange Management Shell
After the Exchange 2007, in Exchange 2010 removing particular email from all users mailboxes, has got changed a lot, as now we cannot use Exchange 2003 ExMerg tool to forcefully remove the particular email from Exchange 2010 Information Store, with Exchange 2010, we need to use Exchange Management Shell to remove desired email from users mailboxes.Here, one interesting stuff is that, in both version of Exchange 2010 RTM and SP1, the syntax is quite different from each other to accomplish this task, where Exchange 2010 Sp1 uses Search CMDlet to finds email first, and delete the email with addition of -deletecontent parameter.
Note:
For Exchange 2010 (RTM) version, please read my earlier post: http://zahirshahblog.com/2010/10/31/removing-specific-messages-from-your-exchange-messaging-infrastructure/
In this Article, I will show you how you can remove particular email with specific Sender or specific Email Subject, where we will be using Exchange 2010 log feature to log the result of the commands for bulk of users to another mailbox for our future reference.
First of all, you need to give the “Discrovery Management” group rights to the mailbox, from where you will be running this command, and for this do the following:
You can’t use Search-Mailbox without grant the user permission to do that
Now we will delete the specific email as per the below scenarios:
| Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery “Subject: Weekend Party Invitation “,”From:zahir@domain.com”,”Sent:05/09/2012″ –DeleteContent -TargetMailbox “mailadmin@domain.com” -TargetFolder “export-folder” -loglevel full |
Scenario 2): Where the all the below elements related to message are known:
Subject: N/A
Sender: (ayniee@domain.com – Sender Email Address)
Date: (05/09/2012)
| Get-Mailbox -resultsize unlimited | Search-Mailbox -SearchQuery “From:ayniee@domain.com”,”Sent:05/10/2012″ –DeleteContent -TargetMailbox “mailadmin@domain.com” -TargetFolder “export-folder” -loglevel full |
Zahir Hussain Shah
MVP Exchange Server
Infrastructure Consultant
Blog: http://zahirshahblog.com | LinkedIn | Twitter
Leave a comment