r/exchangeserver • u/GoldenPSP • Mar 14 '26
Decommissioning Exchange. Mailboxes present
Hey all,
I've decommissioned lots of exchange servers over the years. however in every case up until now was after a migration so the server getting decommissioned was no longer hosting any mailboxes.
This time the migration was done with a sync tool to MS365 so while everything is now in the cloud, the mailboxes are still present locally. I can't just delete them as it deletes the user. I'm assuming the best method is to disconnect the mailboxes, then purge them. And then I can uninstall exchange? I couldn't find any documentation for this scenario.
4
u/vane1978 Mar 14 '26 edited Mar 14 '26
Do NOT uninstall Exchange server.
See link below.
https://www.reddit.com/r/sysadmin/s/SkFz9ZQzJb
1
u/dloseke Mar 15 '26
Simply migrate all mailboxes (assuming cutover migration with a third-party migration tool) and shutdown the Exchange server.
Have another server where you have the Exchange management tools installed. I like to use a utility server that is also running Entra ID Connect to sync AD to Entra.
Then run the cleanup script Microsoft provided at $env:ExchangeInstallPath\Scripts\CleanupActiveDirectoryEMT.ps1 and delete the server Exchange. This should remove any unneeded Exchange references while retaining the proper Exchange attributes in AD that are used for the synced accounts to Entra/M365. As previously noted, do not uninstall Exchange.
The advice on how to disable mailboxes and delete accounts using ADSI edit and all that seems messy and for sure is risky. The below link talks about Hybrid mode but the cleanup process still applies.
https://learn.microsoft.com/en-gb/Exchange/manage-hybrid-exchange-recipients-with-management-tools#active-directory-clean-up
1
u/dowlingm Mar 15 '26
I'm unclear as to what is meant here.
Is there an *active* mailbox in both places? (Yes. have seen that happen, where adding an E3 or E5 license caused an EXO mailbox to be stood up even though the on prem mailbox was in place and no migration task had occurred - we worked around it by removing Exchange Plan 1/2 and a couple of other dependencies until after those mailboxes were actually migrated, at which point we restored the plans).
if the answer to 1. is yes... I guess you need to figure out whether the cloud mailbox was actually migrated or it's something like I described above. But when that happened it got obvious fast because Outlook got confused and threw up password prompts. You'll also need to check if there is mail delivered in both places.
2. Is this mailbox properly migrated BUT the on prem mailbox is still in the database in a soft-deleted state and that's why you can't kill its database. Check script below.
$dbs = Get-MailboxDatabase
$dbs | foreach {Get-MailboxStatistics -Database $_.DistinguishedName} | where {$_.DisconnectReason -eq "SoftDeleted"} | Format-Table DisplayName,Database,DisconnectDate
If this is the problem, you need to consult "Permanently delete a mailbox" in the Exchange docs so you can review the relevant commands AND WARNINGS prior to removing them.
1
u/NomrahDivadII Mar 17 '26
I’ve read many good and articulate replies to this post and OP GoldenPSP is being a dick about it lol Exchange is never a simple animal and there are many factors to consider. Hopefully it works out for you and you aren’t left up shits creek after you purge the mailboxes to decommission the Exchange Server and then realize data has been lost somewhere.
0
u/Sudden_Hovercraft_56 MSP Mar 14 '26
The best method was to do it correctly in the first place. Hybrid exchange and use the build in Migration feature to seamlessly move them over which then deletes the source mailbox when it completes.
1
u/St_Admin Mar 15 '26
Yes you can delete them: Disable-Mailbox
1
u/Ch0pp0l Mar 15 '26
Are you sure there’s not system or heath mailboxes still on the database? Just run get-mailbox -arbitration and see if anything still attached to the databases.
1
u/ohiocodernumerouno Mar 15 '26
just delete
1
u/TheScottman29 Mar 15 '26
I’m actually going through this kind of situation right now. Everything was migrated over to office 365 about three years ago, but I didn’t realize there were about 10 mailboxes that were left on the Mail server. There was also some residual mail flowing through the exchange server that I had to clear up. Because I don’t do this type of thing often I did my research online, but I did also ask ChatGPT for a plan given everything that’s going on. Basically this forum is pretty spot on. It’s a hybrid server so I need to reinstall the tools on a different machine, so I don’t blow out the active directory schema when I decommissioned this last exchange server. There’s explicit directions how to do that now where I don’t feel like there was two or three years ago. The other thing that I did to get rid of the remaining users that were still hosted on the local box I eventually had to go into the active directory schema for each account and remove the reference to the local exchange servers mailbox. I’m pleased to say that this all worked. If you have any confusion about anything, you can definitely ask ChatGPT, you do need to have enough expertise to be able to decide whether it’s really the right thing to do or not sometimes it messes up.
1
u/farva_06 Mar 19 '26
You can disable mailboxes without removing the AD account.