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
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.