LockedRemoving disconnected mailboxes in Microsoft Exchange Server 2010

Author
moon
Junior Member
2012/01/10 04:44:19 (permalink)

Removing disconnected mailboxes in Microsoft Exchange Server 2010

Today I find long list of disabled mailboxes in the HC panel under couple of domains how can I remove them all at once in Exchange Server, obviously there is an option to remove one by one but its difficult to remove more than 100 accounts.
#1

1 Reply Related Threads

    patrick
    Premium Member
    Re:Removing disconnected mailboxes in Microsoft Exchange Server 2010 2012/01/10 08:31:16 (permalink)
    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 }
    ExampleDelete 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 }
    post edited by patrick - 2012/01/10 08:36:35
    #2
    Jump to: