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.

 

 
 
Allen White
Allen is a Consultant for ITPS 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.

ITPS provides strategic IT consultancy, implementation, data centre provision and unified communications, as well as support services and workspace and disaster recovery. If you require a consultation then please contact me via the contacts section or direct on 07931222991, add me on linkedin. https://uk.linkedin.com/in/allenwhiteconsultant0001

Tags:

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.