Tuesday, July 27, 2021

Deleting a Specific Email from Entire Organization in Exchange 2010

This is an extract from a post at Microsoft Social Technet:

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"

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

New-Managementroleassignment –Role "Mailbox Import Export" –User "Administrator"

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

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

Now we will go ahead and delete it

Get-mailbox | search-mailbox –searchquery "Subject:'virus'" –DeleteContent

No comments:

Post a Comment