Remove disconnected mailboxes from the database using Powershell in Exchange 2007
Get-MailboxStatistics -database “SERVER\Mailbox Database” | where {$_.disconnectdate -ne $null} | foreach {Remove-mailbox -database $_.database -storemailboxidentity $_.mailboxguid}