Saturday , May 26 2018

Deleting a Specific Email from Entire Organization in Exchange 2010

Updated – Supports Exchange 2010/2013/2016 and Office365

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

 

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Exchange Server MVP , Publisher of CareExchange.in
Supporting/Deploying/Designing Microsoft Exchange for some years.
Extensive experience on Microsoft Technologies.

Check Also

Policies you should never configure on Windows 10 with WSUS

When you have windows 10 in your environment and machines are configured with Windows Server ...

17 comments

  1. Howdy just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Ie. I’m not sure if this is a format issue or something to do with browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the issue solved soon. Thanks

  2. Thanks for your post. I would like to ask you that if the subject was written in unicode format. I coudn’t for sure copy the subject in Arabic format to Exchange-Shell it well show “??????”. how can I solve this issue.

  3. aslam.haniffa@gmail.com

    I need help, I have exchange 2010 SP3. I want to remove all emails from all the mailboxes send by a particular recipient in our organization. All correspondence “from and to” to this recipient must be removed, please help me how to do it.

  4. This worked great to get rid of the messages. Should I now removed those accounts from the Mailbox Import Export and Discovery groups/roles?

    • Satheshwaran Manoharan

      Yes, You can remove them if you wish . Not that mailbox has access to all the mailboxes in your environment.

  5. i have one question, i want to search and delete all message from one mailbox (example: apc@domain.com) sent to all mailbox (*@domain.com). Please help me how to do it. Thanks.

  6. AWESOME! Absolute champion post!

  7. I don’t even know the way I ended up here, however I assumed this submit used to be good.
    I do not realize who you are however certainly you’re
    going to a well-known blogger in case you are not already.
    Cheers!

  8. Here is the search syntax documentation: https://msdn.microsoft.com/en-us/library/ee693615(v=exchg.140).aspx

    If you add | where-object {$_.ResultItemsCount -ne 0} to the search and delete PowerShell commands, you’ll just see the mailboxes where the content was found, instead of the entire list of them.

    For example:
    Get-mailbox | search-mailbox –searchquery “Subject:’virus'” –Logonly –Targetmailbox administrator –Targetfolder Inbox | where-object {$_.ResultItemsCount -ne 0}

  9. I have created an user and user is member of “Discovery management group” and mailbox import and export
    and yet when I am trying to delete any specific mail. I am getting error as mentioned below.

    “The target mailbox or .pst file path is required”

    can any one help in this issue

  10. ashish kumar singh

    I have created an user in my exchange 2010 environment who is member of below given groups

    1)Discovery management group
    2)Mailbox import export

    when I am trying to delete mail I am getting error like:

    “The target mailbox or .pst file path is required”.

    please any one can help in this regard.

Leave a Reply

Your email address will not be published.