I ran into an interesting issue while I was removing an Exchange 2016 server from an environment. The uninstall process failed on step 5 of 13 and threw an error. The error itself is not all that important for this article, since there are many different errors that might put you in the same position I found myself in, rare as that may be.
When Exchange setup fails on an uninstall the first thing you would logically try is another uninstall. Unfortunately, Exchange setup now throws an error message that…
An incomplete installation was detected. Run setup to complete Exchange installation.
Taking Exchange at its word, I tried to reinstall the partially uninstalled server by running setup again.
D:\>setup /m:install /r:m /iacceptexchangeserverlicenseterms
Welcome to Microsoft Exchange Server 2016 Cumulative Update 3 Unattended Setup
File copy complete. Setup will now collect additional information needed for installation.
Mailbox role: Transport service
Mailbox role: Client Access service
Mailbox role: Unified Messaging service
Mailbox role: Mailbox service
Mailbox role: Front End Transport service
Setup previously failed while performing the action "Uninstall". You can't resume setup by performing the action
Thinking back to other Exchange setup-related disasters I've encountered, I remembered that Exchange stores some information about setup progress in the registry. There's a tip about it here on the Exchange Masters blog. Setup is failing on the Front End Transport service in my case (see above), which is the “FrontEndTransportRole” in the registry.
After removing the Action and Watermark entries, I tried the Exchange install again. This time setup was able to complete the installation, which repaired the server. I was then able to run setup again to uninstall the server, which was successful.
Now, during all this I was asked whether we could just power off the server and remove it using ADSIEdit. As you hopefully already know, removing an Exchange server (or really, doing anything at all) in ADSIEdit is an unsupported method. Sure, there's lots of war stories out there where people have gotten away with it and everything has continued to work okay in their environment (as far as they can tell), but I would never recommend it and certainly don't do it for customers.
If you did have a server that was beyond repair and wanted to cleanly remove it from your environment in a supported manner, the correct approach is to use a recovery install. Recovery installs are available for all of the current versions of Exchange, and there's really no excuse for not doing one if the scenario calls for it.