Abstract: During a exchange installation / update you got the error message “Setup can`t use the domain controller <STRING> because it belongs to Active Directory site <STRING>” and you couldn`t complete the setup.
The full error message is written below:
Setup can`t use the domain controller 'DE' because it belongs to Active Directory site 'DE-DC'. Setup must use a domain controller in the same site as this computer (dc01.int.contoso.com).
For more information, visit: http://technet.microsoft.com/library(EXCHG.150)/ms.exch.setupreadiness.DomainControllerIsOutOfSite.aspx
Possible solution 1:
It might be that a static domain controller was set via:
Set-ExchangeServer -Identity exch01 -StaticDomainControllers DC01.int.contoso.com -StaticGlobalCatalogs DC01.int.contoso.com
So use the command above to set that to the correct domain controller (or change the site assignment inside site and services).
Possible solution 2:
If you run Microsoft Exchange 2016 try to use (as written here):
Setup.exe /mode:Upgrade /DomainController:dc02.int.contoso.com /IAcceptExchangeServerLicenseTerms