31 C
Dubai
Friday, November 22, 2024

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

 

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a Technical Advisor for various start-ups.

Related Articles

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. 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?

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

  5. 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!

  6. 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}

  7. 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

  8. 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

Please enter your comment!
Please enter your name here

× How can I help you?