Having transferred a number of old mailboxes out to PST (Exchange 2010 SP1 is awesome!) I needed to purge the now deleted users and the associated mailboxes.

This was part of an Exchange 2007 to 2010 migration where I found the helpful commands here & here.

In brief:

Set the the Mailbox Database retention period in the Exchange 2010 console. This is found via Organization Configuration – Mailbox – Database Management Tab – Select the Database and Right Click to view Properties – Limits Tab and then set the Deletion settings to Zero whilst unticking the ‘Don’t Permanently delete…’ option.

Load up the Exchange Power Shell and run the below –

Get-MailboxDatabase -server “servername” | Clean-MailboxDatabase “Database Name”

Once done you can now dismount the Database and run the below via CMD to defrag and reclaim the disk space –

eseutil /d “C:\mailbox database path\database.edb”

Now remount the store, set the retention options back to their preferred and job done!