There are many scenarios where we need to get rid of some Emails from the whole server

1. Virus

2.Confidential Email sent wrongly – Got to remove it

3. Need to remove a Email with Specific subject from all the mailboxes

Exchange 2010 has Good features on Searching it and Remove it .

So Will Learn how to do that.

For a User to Execute this commands , he needs specific permissions like he should be a member of Discovery Management role and he should be member of Mailbox Import Export

By Default, Administrator is not a member these roles

Use Exchange Management Shell

Replace the User Name with the Person whom you want to give access to Search and delete

Add-RoleGroupMember "Discovery Management" -Member "User Name"
Or

You can use GUI or Shell, Adding the Discovery Management Role via GUI is much easier.

image

Login with the Exchange Control Panel URL below -

image

Login with Admin Credentials -

image

Double Click on Discovery Management and Add Administrator as a member of Discovery Management and Save it

image

image

===============

To Add a User in Mailbox Import Export Role – Run in Exchange Management Shell

New-Managementroleassignment –Role “Mailbox Import Export” –User “Administrator”

image

===========

Close and Reopen the Exchange Mangement Shell – so that the new commands will start working

===========

Now Before Deleting in Bulk , We can use a log only switch to verify how many Mails we are going to delete

and to verify the we are going to delete the right one

Get-mailbox | search-mailbox –searchquery “Subject:’virus’” –Logonly –Targetmailbox administrator –Targetfolder Inbox

Now this will show how many mailboxes have this content

image

A mail will be generated to Administrators inbox with Item Count As shown below –

image

=======

Now we will go ahead and delete it

Get-mailbox | search-mailbox –searchquery “Subject:’virus’” –DeleteContent

image

Before — From All the Mailboxes

image

Now its gone from All the mailboxes

image

Reference link -

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

Hope it helped you to understand better !!

If you feel its too confusing – Check out the Automated Script to do these tasks for you

Discovery Search Simplified Script to Delete a Specific Email and other Tasks – Exchange 2010

Regards

Satheshwaran Manoharan