After Migration to Microsoft 365 next step is to decommission the on premises Microsoft Exchange environment . Removing Exchange server seems simple process. Just hit remove program and follow the wizard.
In most cases it end up in prerequisite checks most of those are simple to follow i,e manage if any mailbox exists on the Database.
One error encounter in old and large deployments is related to distribution groups.
Error:
This computer is responsible for expanding the membership of 1 distribution group(s). These must be reassigned to another server before Setup can continue.
Click here for help... http://go.microsoft.com/fwlink/?linkid=30939&l=en&v=ExBPA.14&id=9b815db1-19fa-482b-8218-ba8affef57eb
common suggestion to this issue is to change distribution group using following
Get-DynamicDistributionGroup | Set-DynamicDistributionGroup -ExpansionServer $null
Which often comes out with noting
Simple and quick solution is to change the legacyDN of the server you are trying to decommission using ADSI Edit .
Open ADSI Edit (Click Start and Type ADSI would find it) , Select Configuration Context and click OK
Go to CN=Services >> CN=Microsoft Exchange >> CN=Exchange Administrative Group (FYDIBOHF23SPDLT) >>CN=Servers
Right click on the Server you need to uninstall and click Properties
In Attribute Editor Find legacyExchangeDN
Click Edit , Copy the Data in filed in Notepad for backup
Remove all data in the field and Enter the server name Only in the filed .
Click Ok and Apply
Go Back to Exchange Server and Try uninstall it will run without any error.
Note: Please be careful with ADSI EDIT (Click For Microsoft Guide) . Changes performed with tool are not reversible and may lead to fatal errors in Active Directory and Exchange Environments.