Avatar of ajdratch
ajdratch
 asked on

Exchange 2010 remove disconnected mailbox error - doesn't exist on database "mailbox"

I moved a client from Exchange 2010 to Office 365. Now that the migration is done, I want to remove Exchange.  All the mailboxes are disconnected however I can't remove them. I ran the commands:
 
$mailboxes = Get-ExchangeServer | Where-Object {$_.IsMailboxServer –eq $true} | ForEach-Object { Get-MailboxStatistics –Server $_.Name | Where-Object {$_.DisconnectDate –notlike ‘’}} | select displayname, mailboxguid, database

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

I then get this message for every disconnected mailbox

Mailbox "31ea850d-6a5d-4286-9441-d5baf6c7c4ef" doesn't exist on database "Mailbox".
    + CategoryInfo          : NotSpecified: (0:Int32) [Remove-Mailbox], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : DFBA03DE,Microsoft.Exchange.Management.RecipientTasks.RemoveMailbox


I stopped the sync this morning by running Set-MsolDirSyncEnabled -EnableDirSync $false.

How can I remove these disconnected mailboxes
ExchangeMicrosoft 365

Avatar of undefined
Last Comment
ajdratch

8/22/2022 - Mon
Paul MacDonald

Is there more than one mailbox database?  

Or (maybe more likely) is this an old AD object that existed in a mailbox database prior to Exchange 2010?  The AD object may still exist, but the mailbox database it refers to no longer exists.  As it is, it's only passing back the GUID for the object.  It's entirely possible these items that won't remove themselves can't because they never existed in Exchange 2010.
ajdratch

ASKER
These are all the mailboxes that that were migrated to Office 365 so they did exist in Exchange 2010
ASKER CERTIFIED SOLUTION
ajdratch

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23