Video Screencast Help
Archiving and eDiscovery Community Blog

Clearing out deleted mailboxes

Created: 24 Jul 2013 • Updated: 29 May 2014 • 6 comments
Rob.Wilcox's picture
+4 4 Votes
Login to vote

I've been doing a lot of testing just recently with Exchange 2010 (and Archive Shuttle and Enterprise Vault).  One of the things that I have needed to do is to create hundreds of mailboxes, populate them with the data, do some testing, then delete all the mailboxes and actually get rid of them.

In Exchange 2010 deleted mailboxes are not quite gone.  There are a couple of extra steps which are needed.  Let's see:

Firstly, my Exchange Management Console looks a bit like this:

1.png

But I want them all to be gone.  I can right click and choose ‘Remove’:

2.png

But, check here in the management console:

3.png

So now fromthe Exchange Management Shell I would run:

$mailboxes = Get-ExchangeServer | Where-Object {$_.IsMailboxServer –eq $true} | ForEach-Object { Get-MailboxStatistics –Server $_.Name | Where-Object {$_.DisconnectDate –notlike ‘’}} | select displayname, mailboxguid, database

Followed by:

$mailboxes | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }

And now back in the Exchange Management Console it looks like this:

4.png

Happy :)

Comments 6 CommentsJump to latest comment

AKL's picture

Thanks Rob, the cmdlets surely sounds helpful.

However, you do not need to clear out disconnected mailboxes manually from Exchange 2010. Based on retention set for deleted mailboxes on exchange database properties, the mailboxes will be purged/removed automatically.

For example if you'll like to purge deleted mailboxes right away, you can set retention for deleted mailboxes for 0 days without awaitijng backup.

http://technet.microsoft.com/en-us/library/dd297937(v=exchg.141).aspx

Also, difference between disabling mailbox and removing mailbox is that when you "remove" mailbox, it'll delete corresponding AD account as well. Whereas if you disable mailbox, it'll only remove exchange attributes from AD account keeping the account itself intact.

Thank You

AKL

+1
Login to vote
Rob.Wilcox's picture

Great stuff.  Thanks for the extra gems of information, much appreciated.

0
Login to vote
John Santana's picture

Thanks Rob !

Kind regards,

John Santana
IT Professional

--------------------------------------------------

Please be nice to me as I'm newbie in this forum.

0
Login to vote
JesusWept3's picture

FWIW it doesnt apply to Exchange 2010 base or SP1 release as Disconnected Mailboxes was introduced in SP2

+2
Login to vote
TamTam's picture

Arent they really gone after a offline defrag?

0
Login to vote
Rob.Wilcox's picture

Not sure... But that's not something you would perform very often.

0
Login to vote