Exchange Server 2010 – Purge the Deleted Items (RecoverableItems) Folder

Being the devoted Email Administrator that you are, you notice that the space for storing mailboxes on your Exchange Server is getting dangerously low, so you decide to take action. Logically, your first thought would be to have all your end users go through all the folders in their mailbox and get rid of any junk they don’t need and then empty their “Deleted Items” folder to regain the space back. After all, in most cases there really is no reason for users to keep every single email they’ve ever sent and received since the beginning of time (which a lot of them tend to do and I’ll never understand why).

Unfortunately, as you’ve probably already noticed, that is not the case. Simply having a user empty their “Deleted Items” folder has no effect on the database size whatsoever. This is partially due to the nifty feature that allows users to be able to recover deleted messages after they’ve already emptied their trash. By default, Exchange keeps deleted items for 14 days until they are purged, so now it is necessary to manually force the deletion of these items.

The only problem now, is that not only must you purge the RecoveryItems folders, but you will also either have to create and move all the mailboxes to a different database or you have to run an offline defragment of each of your mailbox databases which means taking everybody down and if you are low on space as it is, you better hope you have lots of spare time and/or space out on a network share to temporarily store the databases as they are defragged because it takes one and a half times the storage space you already have in use.

Anyways, straight from technet, here is an example of how to purge the RecoverableItems folder and copy them to a different folder at the same time (which I am unsure why you would want to copy it to the discovery search mailbox in the example, but who am I to question it):

Search-Mailbox -Identity "Gurinder Singh" -SearchDumpsterOnly -TargetMailbox "Discovery Search Mailbox" -TargetFolder "GurinderSingh-RecoverableItems" -DeleteContent

On your first try, it probably won’t even work anyways so if you get a message saying “The term ‘search-mailbox’ is not recognized as the name of a cmdlet”, then you need to add the user your logged in as to the “Discovery Management” group in Active Directory, then lather, rinse, and repeat (close and reopen the shell and resubmit commands).

Add User to "Discovery Management" Group in Active Directory

Let’s give it a try again shall we: ***BUZZ***

Still no workie. Yet another step before you can even run the -DeleteContent switch is that you have to give your user account permission to have the “Mailbox Import Export” role by using this command and then lather, rinse, repeat, again…

New-ManagementRoleAssignment –Role "Mailbox Import Export" –user "administrator"

Now you should be able to get down to it. Instead of following the steps above, to just purge a single user’s RecoverableItems folder or what used to be referred to as “The Dumpster”, use this command:

Search-Mailbox -Identity "Gurinder Singh" -SearchDumpsterOnly -DeleteContent

To purge all user’s RecoverableItems folders, issue this command:

Get-Mailbox | Search-Mailbox -SearchDumpsterOnly -DeleteContent

And as I mentioned before, that is only half of the battle. After purging the dumpster, you still have 2 choices to pick from to regain your lost storage space.

  1. Mount a local or network drive that has enough storage space and move all the mailboxes into another database, delete the old database, create a new database, and then move all the mailboxes back into the new one.
  2. Run an offline defragment.

Leave a Reply