Open a command prompt on your primary DC and type the following commands in order. Anything in BOLD is the actual command, any comments italicized after anything in bold are helpful instructions. These commands have been tested on Server 2008 R2 so if you get an error or unexpected results, check for spelling errors.
Ntdsutil
Metadata cleanup
Connections
Connect to server “name_of_DC2”
Quit
Select operation target
List domains
select domain “Number”, (where “Number” is the number corresponding to the domain in which the failed server was located. Press Enter.)
select site “Number”, (where “Number” refers to the number of the site in which the domain controller was a member. Press Enter.)
list servers in site This will list all servers in that site with a corresponding number.
select server “Number” ( where “Number” refers to the domain controller to be removed.)
quit
remove selected server
You will receive a warning message, type Yes.
If you run into problems just post back.
Good links for Check cleanup in AD:
How to perform Metadata cleanup in Active Directory
https://community.spiceworks.com/t/how-to-perform-metadata-cleanup-in-active-directory/1011296
and how to move FSMO Roles via NETdsutil oder PowerShell
https://scarymachines.de/fsmo-rollen-uebertragen-per-ntdsutil-oder-power-shell/
Ntdsutil:
Ntdsutil
Roles
Connections
Connect to Server <Traget- Server DC>
Q
transfer Infrastructure Master
transfer Naming Master
transfer PDC
transfer RID Master
transfer Schema Master
Q
Q
PowerShell:
Move-ADDirectoryServerOperationMasterRole -Identity <Ziel-DC> -OperationMasterRole SchemaMaster,RIDMaster,InfrastructureMaster,DomainNamingMaster,PDCEmulator -whatif
Move-ADDirectoryServerOperationMasterRole -Identity <Ziel-DC> -OperationMasterRole SchemaMaster,RIDMaster,InfrastructureMaster,DomainNamingMaster,PDCEmulator
PDC Emulator (0)
RID Pool Manager (1)
Infrastruktur Master (2)
Domain Naming Master (3)
Schema-Master (4)
Move-ADDirectoryServerOperationMasterRole -Identity <Ziel-DC> -OperationMasterRole 0,1,2,3,4
Move-ADDirectoryServerOperationMasterRole -Identity <Ziel-DC> -OperationMasterRole 0,1,2,3,4 -Force
How to demoting RODC ( Chatgpt):
dcpromo /unattend /AdministratorPassword:<NeuesAdministratorPasswort> /demoteRODC:Yes /ForceRemoval /DeleteDNSDelegation:Yes