Glazenbakje's Weblog

Just another way to express myself

Delete a disconnected mailbox from exchange 2010

As you probably already know in Exchange 2010 the Purge option disappeared and there is actually almost no easy way to remove a disconnected mailbox from the exchange 2010 server. When you removed an users the disconnected mailbox will disappear hidden. The get is back non hidden you have to use an easy command in the Exchange Management Shell

clean-mailboxdatabase "Mailbox Database 1166050598"

However you should get all information about the mailbox of the deleted user and disconnected mailbox. To get this information you should use the Exchange Management Shell. You can use the following command..

Get-MailboxStatistics -Database "Mailbox Database 1166050598" | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

Result

DisplayName    : USERMAN
DisconnectDate : 1-7-2010 16:00:48
MailboxGuid    : def4aabd-2156-5857-858f-470efc3e6f28

Thake the MailboxGuid and copy it to Notepad. For easy modification.

This MailboxGuid is needed to remove the mailbox completely.

Remove-Mailbox -Database "Mailbox Database 1166050598" -StoreMailboxIdentity def4aabd-2156-5857-858f-470efc3e6f28

After this command the mailbox is defiantly gone from your Exchange server.

[ exchange management console
> Microsoft Exchange On-Premises
> Recipient Configuration
> Disconnected Mailbox ]

with more disconnect mailboxes you could write a batch file for removing.

UPDATE: There is a way to delete all the disconnected mailboxes via [ http://www.petenetlive.com ] I used the followin commands to delete a bounce of mailboxes at once.
First run the command in the administrative exchance console.

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

After this command you have to use the following command line.

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

If you have done this you can check in the exchange console if the disconnected mailboxes are gone.

Update2 extra option to use:
If you use the following command. users will be deleted for sure.

Get-MailboxStatistics -Database "<database>" -OutBuffer 1000 | ? {$_.DisconnectReason -eq "SoftDeleted"} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

Attention: I reconized some issues with command’s to solve this issue copy past the command into notepad and check if there are no ? where ” needed. Most of the time it’s on the end of a command. The command’s shown above are correct. Only HTML > powershell is not optimal sometimes.

About these ads

25 responses to “Delete a disconnected mailbox from exchange 2010

  1. rajesh 5 January 2011 at 07:21

    Well.it works fine

  2. Trung 30 March 2011 at 04:25

    Work like a charm!!!

    Thanks

  3. Kenny 19 April 2011 at 22:58

    THANK YOU!!!!!!!!!!!!!!

  4. Andrew Millar 10 June 2011 at 04:49

    Thankyou for this, worked a treat!

  5. vale 28 February 2012 at 18:57

    Muchas gracias. Faltó eso si, informar cómo se eliminan varios a la vez.

  6. Peter de B 27 March 2012 at 13:07

    Thanks for the article, it was very usefull :)

  7. Edmarcio 2 May 2012 at 18:06

    Thank you, helped me a lot

  8. Uncle Scrooge 23 May 2012 at 10:17

    Excellent! Saved and bookmarked!

  9. Chris 14 June 2012 at 17:59

    Thanks for this! Followed your instructions and I finally managed to purge disconnected mailboxes from the Management Console. Unfortunately, that made no impact on the data size overall (which is why I was trying to achieve this in the first place). I know this is slightly off topic but any indication why this has happened?

    • Fred 14 June 2012 at 18:02

      It’s because The Database of Exchange 2010 will fill up the empty space with the new data. You can run the old fashion way eseutil but you can also run the 24/7 defragmentation in Exchange. To get the free space you need to use eseutil. Up to 500GB it’s worth to use eseutil after 500GB not anymore. ( I’ve read this in some microsoft documentation. Can’t remember where I found it. )

      • Chris 14 June 2012 at 18:24

        Running eseutil means an outage, no?

      • Fred 14 June 2012 at 18:25

        Indeed that will lead to an outrage of the network / exchange / mail traffic for a couple of hours. ( an other option is to create a new Database and move all the mailboxes to that database )

  10. Chris 14 June 2012 at 18:28

    Both are scary prospects, since the Exchange DB size is currently at 800GB +.

    If I have 24/7 maintenance running, will that reclaim that “white space”?

    • Fred 14 June 2012 at 18:48

      you are right about that. It could be scary.. 24/7 maintenance will keep on track about the white space and free more white space when mail or mailboxes are deleted. How ever it won’t reclaim disk space like ESEUTIL does.

  11. Brian E. Conklin 1 August 2012 at 21:41

    Another thing to note about ESEUTIL, you need at least as much free drive space as the size of your current database to defrag into.

  12. Pingback: Delete disconnected mailbox +exchange 2010 « Raydha's Blog

  13. Pingback: Delete a disconnected mailbox from Exchange 2010 | V3ct0r's Tech Knowledge base

  14. rfuller02 7 June 2013 at 23:05

    And Microsoft actually does not recommend running ESEUTIL on Exchange 2010 databases. The preferred method is to move mailboxes to a new database and delete the old database. This does, unfortunately, mean you need lots of free disk space until you get all of the mailboxes moved.

  15. Panch 20 January 2014 at 11:39

    Please advice- We have 2 TB of data to be purged from a mailbox, will it release the white space.
    We need recreate new db and move the users then delete the old content

    • Fred 20 January 2014 at 11:43

      If you can’t have downtime on you mailbox store you have do this. If you’re able to have downtime on your mailbox store you can use the old fashion “eseutil” command to decrease the mailbox store.

  16. Panch 20 January 2014 at 13:42

    More than 500 GB size, is “eseutil” recommeded

  17. Dan 19 February 2014 at 22:44

    when I try and use this, at 1st command I get an error:
    WARNING: The database ‘AAFXCH1\Recovery Storage Group\Mailbox Database’ to be
    accessed on server ‘aafxch1.xxxxxxx.com is not mounted or is
    not available.

    • Fred 20 February 2014 at 12:15

      I think this is not prossible to do from a recovery storage group. I have never tried it from the recovery storage group.
      If you try to select an other database do you get the same warning?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 433 other followers

%d bloggers like this: