Removing disconnected mailboxes in Exchange 2010

List mailbox databases guid
> Get-MailboxDatabase |ft Name, Guid

List disconnected mailboxes in a specific database
> Get-MailboxStatistics -Database <database guid> | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

Delete a specific disconnected mailbox
> Remove-Mailbox -Database “<databasename>” -StoreMailboxIdentity <mailbox guid> -confirm:$false

Delete all disconnected mailboxes in a specific database
> $users = Get-MailboxStatistics -Database “<databasename>” | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database

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

Example
Delete a specific disconnected mailbox in the database named My Database
> Remove-Mailbox -Database “My Database” -StoreMailboxIdentity g437dd12-2f96-4a67-8f6f-c47fa70247e2 -confirm:$false

Delete all disconnected mailboxes in the database named My Database
> $users = Get-MailboxStatistics -Database “My Database” | where-object { $_.DisconnectDate -ne $null } | Select DisplayName,MailboxGuid,Database

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


Posted

in

by

Tags:

Comments

7 responses to “Removing disconnected mailboxes in Exchange 2010”

  1. PeteLong Avatar

    Here’s some more information that might be helpful,

    Exchange 2010 – Delete / Remove all Disconnected Mailboxes

    Pete
    PeteNetLive

  2. Joe Avatar
    Joe

    Thank you very much, works like a Sharm, saved lot of time and efforts.

  3. Amrut Avatar
    Amrut

    This is very simple n sober way to do this.
    Thanks a lot.

  4. Ali Avatar
    Ali

    Thanks mate,

    worked perfect!

  5. simon Avatar
    simon

    Excellent thanks. Simple, easy to understand. Worked a treat.

  6. Scott Avatar
    Scott

    After much frustration reading the MS examples, this has come as a refreshing step-by-step dose of common sense. Thank you so much!

  7. nikko Avatar
    nikko

    Thank you very much..
    worked perfect..

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.