How to remove Ghosted mailboxes

Posted on Updated on

Ghosted mailboxes sometimes appear after a mailbox move on the source database.  The move request will have a status ‘Completed with warning’ and the status log will have something like “Failed to clean up the source mailbox “<SID>” after the move”.

To find the disconnected mailboxes,

Get-MailboxStatistics -Database “DATABASE NAME” | Where-Object {$_.DisconnectDate -Notlike $NULL} | FL DisplayName, DisconnectDate, MailboxGuid

To dump it to a CSV, add the command “| Export-CSV dump.csv” at the end of the script above

To find an individual mailbox that is in this state based on its GUID,

Get-MailboxStatistics -Database “DATABASE NAME” | Select displayname, MailboxGUID, Mailbox, DatabaseName | Where-Object { $_.MailboxGUID -eq “GUID”}

To successfully remove the Ghosted mailbox, run the following command

Remove-Mailbox -Database “DATABASE NAME” -StoreMailboxIdentity GUID

Update:  If you are getting a message that says the mailbox GUID does not exist on the database, you may try running the ‘Remove-StoreMailbox’ commandlet.  An example of the script is below

Remove-Storemailbox -database <database Name> -identity <Mailbox GUID> -mailboxstate SoftDeleted

Get-MailboxStatistics -Database “databasename” -OutBuffer 1000 | ? {$_.DisconnectReason -eq “SoftDeleted”} | foreach {Remove-StoreMailbox -Database $_.database -Identity $_.mailboxguid -MailboxState SoftDeleted}

Advertisements

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