Unable to uninstall Exchange 2016 CU23

Ivan Kucheryaviy 35 Reputation points
2023-03-06T15:00:42.0066667+00:00

Hello.

We have a lot of exchange servers in our organization and sometimes we need to uninstall exchange for re-organizing environment. It is easier to add new server migrate stuff there and then uninstall old servers.

During such tasks I have found that it is impossible to uninstall Exchange 2016 CU23, while other versions were uninstalling with no problem.

When I uninstall exchange server uninstall successfully runs throug removing Mailbox role, removes object from AD organization, but then follows to uninstall Unified Messaging Role and fails on

Error:
The following error was generated when "$error.Clear(); 
          uninstall-MsiPackage -ProductCode $RoleProductCode -LogFile $RoleLogFilePath -PropertyValues ("ESE=1");

          $lochost=hostname;
          $exchsrv=Get-ExchangeServer -Identity $lochost -DomainController $RoleDomainController;
          if (-not $exchsrv.IsMailboxServer)
          {
            uninstall-MsiPackage -ProductCode $RoleTeleProductCode -LogFile $RoleLogFilePath;
          }

          if ( $RoleTransProductCode -ne [system.guid]::empty )
          {
            uninstall-MsiPackage -ProductCode $RoleTransProductCode -LogFile $RoleLogFilePath;
          }

          uninstall-MsiPackage -ProductCode $RoleTtsProductCode -LogFile $RoleLogFilePath;
        " was run: "Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException: The operation couldn't be performed because object 'MBX' couldn't be found on 'DC'.
   at Microsoft.Exchange.Configuration.Tasks.Task.ThrowError(Exception exception, ErrorCategory errorCategory, Object target, String helpUrl)
   at Microsoft.Exchange.Configuration.Tasks.GetObjectWithIdentityTaskBase`2.InternalProcessRecord()
   at Microsoft.Exchange.Configuration.Tasks.Task.<ProcessRecord>b__91_1()
   at Microsoft.Exchange.Configuration.Tasks.Task.InvokeRetryableFunc(String funcName, Action func, Boolean terminatePipelineIfFailed)".

This error is absolutely legit - because there's no such exchange server in organization anymore. Uninstall already removed it on previous step. Why it works this way I have no idea. There're no way I could find to at first remove unified messaging role and only after that proceed with removing mailbox role. Also, to my surprise there're no way to repair this installation - nothing helps. uninstall from command prompt, repair, try for reinstall failed installation - nothing helps.

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,448 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,830 questions
{count} votes

7 answers

Sort by: Most helpful
  1. JosElders-3835 0 Reputation points
    2023-06-06T08:58:52.9866667+00:00

    Same problem here; now we have an unused Exchange server halfway uninstalled in our customers' production AD environment which we, ofcourse, want to able to remove completely as soon as possible.

    Powershell admin de-installation and GUI way same error and starting de-installation with Exchange 2016 CU23 ISO same error.

    Previous Exchange 2016 builds we had no issue with this (we did not do de-installations with every build versions tbh).

    @Microsoft When can we expect a fix or workaround (no adsi edit pls) to be able to succesfully de-install Exchange 2016 in AD?

    Kind regards.

    0 comments No comments

  2. Karsten Lorenscheit 0 Reputation points
    2023-06-06T11:23:38.2466667+00:00

    I 'somehow' managed to continue with the uninstallation of Exchange 2016 CU23...

    To be honest: It's not trivial and it's probably not a good idea to fiddle around, especially using ldp.exe, to recover the deleted server object in a production AD. Create a backup beforehand! Always at least double check your changes! I was not careful enough and managed to restore an object to the wrong parent!

    There are some descriptions on the internet on how to use ldp.exe to recover deleted objects manually. But you need to go to the tree/Base-DN within ldp.exe:

    "CN=Configuration,DC=......"

    and descend into:

    "CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=your,DC=domain,DC=local"

    Where you should see the present server objects AND the deleted object that you are looking for!

    Double click it and continue:

    1. Find the "lastKnownParent" in the right part of the ldp.exe window and copy it to a text editor without the trailing semicolon
    2. Modify the entry almost as most often described...right click and so on...
    3. Attribute "isDeleted", Value empty, Operation "Delete", Press "Enter" Button
    4. Recover the original DN from the copied lastKnownParent and the current DN, so it looks like this:

    CN=WhateverServernameItShouldHave,CN=Servers,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=your,DC=domain,DC=local

    1. Attribute "distinguishedName", Value should be the recovered original DN, Operation "Modify", Press "Enter" Button
    2. Check "Synchronous" and "Extended" checkboxes if neccessary and click run

    I repeated this procedure on some sub-objects, that I managed to find under "CN=Deleted Objects,CN=Configuration,DC=your,DC=domain,DC=local" by looking for the lastKnownParent property. I've also recovered the objects below "CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=domain,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=your,DC=domain,DC=local", also found in the "Deleted Objects". But I think it may be enough to just recover the server parent object, not really sure about it.

    I now ran "Setup.EXE /mode:uninstall /IAcceptExchangeServerLicenseTerms_DiagnosticDataOFF" multiple times and followed up on all other errors that I experienced. They were all about IIS being in a kind of unexpected state (maybe I did something to initially get there?). On the screenshot you can see that the uninstallation continueing after I manually created some missing AppPools (Had to do this repeatedly, cause they will get deleted multiple times when retrying!), the "Exchange Back End" Website and descending applications (hints in the screenshot) without configuring them further...

    User's image

    ...yes, it finished ;)

    User's image

    It seems there is nothing else important to do with the server, other than removing it from the exchange organization, removing the object from AD and decommissioning the host itself.

    The restored database objects remained. I will figure out, how to get rid of these.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.