Tuesday, August 7, 2012

How to Delete a particular email from all the mailboxes OR from one mailbox

How to Delete a particular email from all the mailboxes OR from one mailbox


Pre-requisites to per for this task, we need to have the permissions:

Add the User to Discovery Management To Enable Search-Mailbox
Add the User to Mailbox Import Export To Enable -DeleteContent Switch

New-Managementroleassigment -Role "mailbox import Export" -User "administrator"
Now For Example to Delete a Specific Subject. Use log only Switch to verfiy how many counts you are  deleting (Valid one or not )




To delete a specific mail from all the mailboxes & to find out in how many mailboxes the specific mail
is located, for searching in all the mailboxes use below command

[PS] C:\Windows\system32>Get-mailbox | search-Mailbox -SearchQuery "Subject:'\m/, kick ass bye to all'" -Logonly -Target
Folder Inbox -Targetmailbox anand.sunka

It will generate the log like showing in the no. of mailboxes its located.

To delete that email use below command;
Get-mailbox | search-Mailbox -SearchQuery "Subject:'Delete Me'" -DeleteContent


http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/57d23507-a627-492a-a6b4-f04a374cc48a - Link

http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/4e1084ac-1f19-4a57-938a-0ce1cde9e8d2


http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/09ebaa31-9004-45ab-b05c-4986e081bef3/


http://technet.microsoft.com/en-us/library/dd298173.aspx

http://technet.microsoft.com/en-us/library/dd298173.aspx


User had send 1 confidential mail to mail group by mistaken, now he wants to recall but recall
doesn't work out, hence wants to delete the mail from each mailbox of user's, then you need
to run below command to delete particular mail from all the mailboxes

Need to run this command on casnhub server not on mailbox server
[PS] C:\Windows\system32>Search-Mailbox -Identity "Shreejith Mohanan" -SearchQuery 'Subject:"Certificate format Sungevit
y / Process level Metrics / Team alignment "' -DeleteContent



[PS] C:\Windows\system32>Search-Mailbox -Identity "Anjan Chatterjee" -SearchQuery 'Subject:"Revenue Folder "' -DeleteContent


No comments:

Post a Comment