Delete Mail from Multiple Mailboxes

Written by Allen White on. Posted in Exchange 2007, Exchange 2010, Exchange 2013, Server 2008

IT Problem

I had this recently where an email had went around a school and was quite sensitive, I needed to find a way of deleting the email from every mailbox…and fast. Luckily this can be done in power shell So if you need to delete an email in powershell across the organization quickly follow the guide below.

 

Note the new section at the bottom of this article for deleting emails in Exchange 2010 SP1 and Exchange 2013

IT Solution

This can be done with power shell. See the command below. This article applies to Exchange 2010 and Exchange 2013, see later in the guide.

NOTICE out of the box these commands are not enabled, you will need to see this article first if you have not already enabled them – Enable Export Mailbox Commands In Exchange 2010

Once the above is done you can now proceed

Get-Mailbox -Database mailboxdb | Export-Mailbox -SubjectKeywords "Virus message" -DeleteContent

Where  MailboxDB is your store and “Virus Message” is the content

You  will need to use an account that has the correct permissions to give the correct permissions to the user use this command

get-mailbox -Database "Mailbox Database"| add-mailboxpermission -user administrator -AccessRights FullAccess

That command will give the correct rights to the administrator account.

Delete Email From Exchange 2010 SP1 and Exchange 2013

Microsoft changed a few commands for SP1  of exchange 2010.

In Exchange 2010 SP1,and beyond up until Exchange 2013 we use the  New-MailboxExportRequest and the New-MailboxImportRequest to export\import emails. You also use this in conjunction with the  Search-Mailbox command and add the add parameter -DeleteContent.

For example,

Get-Mailbox -Server  "your server" | Search-Mailbox -SearchQuery 'Subject:"pictures of your mum"' -DeleteContent

 

With these commands you will be able to remove email from multiple mailboxes in Exchange 2010 and Exchange 2013.

 

 
 
Related Posts Slider

Related Problems

Setup Exchange 2007/2010 and 2013 Whitelists.
A step by step guide on how to Setup Exchange 2007/2010 and Exchange 2013 Whitelists.How to allow email into your orginization only from whitelisted sources / email whitelists.
READ SOLUTION
Exchange 2010/2007 Send on Behalf , Send as.
If you want to send emails on behalf of other people then we need to setup the send as and send on behalf permissions in microsft exchange 2010 or exchange ...
READ SOLUTION
Exchange 2010 not receiving external mail when first installed.
If you have just installed or upgraded to exchange 2010 you may find the you are not receivinging mail, this is a receive connector issue, read this article to resolve.
READ SOLUTION
Outlook Web Access unable to send or reply to Mail
In outlook web access you find you cannot send or reply to emails. This is a known issue and a patch has been released. Download the patch here.
READ SOLUTION
Check the amount of exchange email sent internally
A guide on how to how to check the amount of exchange email sent internally. How to check yout exchange mail internal statistics.
READ SOLUTION
Exchange 2010 anti spam – enable
A step by step guide on how to enable the anti spam agent in exchange 2010 and 2007. How to stop spam emails in exchange 2007 and 2010.
READ SOLUTION
Forward Exchange 2007 or 2010 email to external account
A guide on how to setup exchange 2010 or 2007 to forward email to an external recipient. How to forward email in exchange,
READ SOLUTION
You cannot mount a new Exchange Server 2010 Mailbox database
If you have just installed exchange 2010, you may find that the default datastore will not mount this is a known issue , Here is how to fix the ...
READ SOLUTION
Setup Exchange 2007/2010 and 2013 Whitelists.
Exchange 2010/2007 Send on Behalf , Send as.
Exchange 2010 not receiving external mail when first
Outlook Web Access unable to send or reply
Check the amount of exchange email sent internally
Exchange 2010 anti spam – enable
Forward Exchange 2007 or 2010 email to external
You cannot mount a new Exchange Server 2010

Tags:

Allen White

Allen is a Technical Consultant for an IT company in the North East of England and holds the following accreditations. MCSA, MCSE, MCTS, MCITP, CCA, CCSP, VCP 4,5 and HP ASE, AIS - Network Infrastructure. Backup Academy Certified. I run this site in my spare time so if I help you then PLEASE take the time to share using the share tools on the site.

What Do You Think?

Search Solutions

Categories

(c) Techieshelp.com. Please be aware, all information is provided freely, any information used is done so at your risk and Techieshelp will not be held responsible for any issue that may occur.