I need to delete some user mailboxes from exchange 2013 database to release the storage. Each of those mailbox has 40-50G of data. Those mail boxes have been exported as backups. There is a retention period of 14 days by default that all deleted items will still be hold in database. The situation is that I need space right now and I want to bypass this retention period and have those mailboxes removed from the hard drive imminently.

Is there a way to do this? I could not find the solution online....

Note: They are disconnected mailboxes, User accounts will still be in AD.


Offline defrags? Is it 2005?

Create a new database and move the mailboxes. Zero risk, zero downtime - unlike an offline defrag.

If you really don't have the space, then another option would be to stand up a temporary Exchange server, move those mailboxes you want to delete to that temporary server and delete them from there. That should give the white space back to the database much quicker than anything else.

Finally, there is another technique to remove those mailboxes using remove-storemailbox. It is outlined in this blog posting:


  • Sadly also not usable given that there seems to be no space available at all. The OP has nicely put himself into a corner - no magic bullets. – TomTom May 3 '16 at 19:29
  • An offline defrag isn't going to be possible either. If there is space to do an offline defrag then there is space to build a temporary server. – Sembee May 3 '16 at 21:22
  • This looks like a doable solution. Fight for budget first. – Root Loop May 3 '16 at 23:43

Deleting the mailboxes isn't going to reduce the size of the mailbox database file. You need to perform an offline defrag of the mailbox database to shrink the file. You might be better off moving all mailboxes to a new mailbox database and removing/deleting the original mailbox database, if you have enough disk space to do so.

  • The problem is the space .......I don't have any extra space on my SAN...all taken by exchange.....OMG....what am i gonna do? No budget to buy any drives.... – Root Loop May 3 '16 at 1:41
  • How much disk space is being taken up by the Exchange transaction logs? – joeqwerty May 3 '16 at 1:52
  • The first thing you should do is not panicking :) Then follow Joe's advice. :) If you have a backup if your Exchange, the defraging and compacting the dB should be safe. Have not done it more than 6-7 times, but I never had a problem. Although, start the defrag after work. – Daniel May 3 '16 at 5:48
  • A defrag will NOT free space if the retention period is not over. So you first have to change the retention period to 0 day, wait for the next maintenance (or modify the maintenance schedule) and check the log to ensure the mailboxes have been marked deleted, then you can perform the defrag. – JFL May 3 '16 at 8:46

List out mailboxes and remove

Get-Mailbox  -Database <database> 

You can do something fast like

Get-Mailbox  -Database DB02 >> C:\MailboxesToDelete.txt

and then

$users=Get-Content C:\MailboxesToDelete.txt
foreach ($user in $users) {
    #Print to screen user mailbox to delete
    Write-Host "User: $($User)"
    #Mark Mailbox for delete
    Disable-Mailbox -Identity $user
    Write-Host Success -foregroundcolor green
    "$($User),Pass" | Add-Content $logfile

You also need to perform offline defrag


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.