Skip to content

How to delete emails on MS Exchange server 2010 SP1

by admin on February 8th, 2011

You can use two solutions to automatically delete/empty mailbox on a MS Exchange Server 2010 SP1.

1) Since MS Exchange 2010 SP1 you can use Retention policies with Retention policy tags , per mailbox , easy to setup and very helpful

Emails can be auto-deleted by being marked with policy tags and after that Managed Folder Assistant “daemon” is checking the aging all the emails .

2) you can setup (in scheduled task) an exchange shell script to delete this emails  :

in task scheduler add a “dos” script  (ex. emptybox.bat):

PowerShell.exe -command “. ‘c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto; C:\Scripts\cleanmbox.ps1”
and in cleanmbox.ps1 you have to set the exchange shell comand
Search-Mailbox -Identity “mailbox id1” -DeleteContent -Force
Search-Mailbox -Identity “mailbox id2” -DeleteContent -Force
-you can set several commands in the same file to empty mailbox for multiple accounts
-use “-Force” to avoid confirmation dialogs
-you may have to add “Mailbox Import Export Role” to a Role Group (
Read more in this regarding other options for Search-Mailbox :
On earlier (e.g. exchange 2010 RTM) use : Get-Mailbox -Database DB1 | Export-Mailbox -SubjectKeywords “Virus message” -DeleteContent
  1. wing permalink

    Thanks, I have been looking for a way to purge emails from Exchange Server directly, and this is very uselful to me. Thank you

  2. Chris permalink

    Been looking for something that can do this but on Exch 2003 ( I know don’t ask )

    Going to give it a try and see what happens

    thanks for the info

Trackbacks & Pingbacks

  1. Tidy up exchange 2010 journaling mailbox - Page 2

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS