Use PowerShell to determine the total size of disconnected mailboxes in a mailbox database
I have been performing some housekeeping tasks which include removing old user mailboxes. While doing this I was curious how much disk space I would be saving so I took a few minutes to leverage the Get-MailboxStatistics cmdlet and calculate the total size of disconnected mailboxes:
Get-MailboxStatistics -Database <database> | Where { $_.DisconnectDate -Ne $Null } | ForEach-Object {[Microsoft.Exchange.Data.ByteQuantifiedSize]::Parse($_.TotalItemSize).ToMb()} | Measure-Object -Sum