Wednesday, May 30, 2018

Force clean up deleted mailboxes in Exchange Database

To view free space in exchange database use this command:

Get-MailboxDatabase -Status | select Name,DatabaseSize,AvailableNewMailboxSpace

When you disable mailbox from ECP, default exchange removes it in 30 days,
if you do not have free space and you want to do delete it force use this commands :

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "disabled mailbox Displayname" } | fl DisplayName,MailboxGuid,Database,DisconnectReason

you will see: something like this:

DisplayName      : Test User
MailboxGuid      : 07f47962-3963-44f1-9974-c298cd7bd6f8
Database         :  MBX01

DisconnectReason :

to completely remove :

Remove-StoreMailbox -Database Cloud-MBX-Custom-1 -Identity "disabled mailbox guid" - MailboxState Disabled

In several minutes free space will added to Datatabase.


No comments: