remove disconnected mailboxes from Exchange

I would like to be able to remove disconnected mailboxes from Exchange
I have already backed up their mails in a PST file on a storage HD, so I do not need the mailboxes in their entirety. FYI - users are no longer in the AD.
I estimate that this could free up close to 10 Gb of space. Can you help me with a Powershell command or other idea?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Please confirm the Exchange version.
If you are using Exchange 2007 or 2010 then you can use the following article from written by Rajith Jose Enchiparambil.
tagltdAuthor Commented:
Sorry...forgot to mention. We are using Exchange 2010 Sp1
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Will SzymkowskiSenior Solution ArchitectCommented:
To permanetly delete mailboxes that are in a disconnected state you need to use the Remove-StoreMailbox cmdlet. I have also provided an example below...

$datebase = "DatabaseName"
Get-MailboxStatistics -Database $database |
? {$_.DisconnectReason -eq "SoftDeleted"} |
foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

Open in new window

AmitIT ArchitectCommented:
Exchange will automatically purge them after it reaches mailbox retention period. Just reduce the DB retention period for deleted mailbox. This way you can avoid manual work of deleting them. Or you can run remove-mailbox and clean-database command. I personally pefer to keep them until db retention period, in case you need to restore them for any reason.

Also note SP1 is no more supported by MS. Move to SP3 with RU8V2 or RU9. Follow my article for smooth upgrade.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tagltdAuthor Commented:
Thanks all. I used a combination of reducing the mail retention period + manually removing the largest mail account. All good!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.