Removing Exchange 2010

This assumes that you are removing the LAST Exchange 2010 Server in a domain after moving to Office 365…

DISABLE the Mailboxes, be careful the other option bins the AD user object as well!!

Delete all User Public folders:
$ExchangeServer = "ServerName"
Get-PublicFolder -Server $ExchangeServer "\" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server $ExchangeServer -Recurse -ErrorAction:SilentlyContinue

Delete all System Public folders:
Get-PublicFolder -Server $ExchangeServer "\Non_Ipm_Subtree" -Recurse -ResultSize:Unlimited | Remove-PublicFolder -Server $ExchangeServer -Recurse -ErrorAction:SilentlyContinue

Delete the Default Offline Address Book.

Delete the Mailbox Databases

Check if a specific mailbox database that you cannot remove through EMC contains a mailbox and what type they are:
get-mailbox -database "Mailbox Database"
get-mailbox -database "Mailbox Database" -archive
get-mailbox -database "Mailbox Database" -arbitration

Assuming that there are arbitration mailboxes, this is how you remove them:
get-mailbox -database "Mailbox Database" -arbitration | disable-mailbox -arbitration -disablelastarbitrationmailboxallowed

Remove any Send Connectors (Organisation Configuration > Hub Transport > Send Connectors)

Uninstall Exchange from Programs and Features.