This is a risky operation from the security standpoint - having access to a domain controller by a third party can be exploited (even if you delete the existing object - keep in mind these can be restored within the tombstone interval - even without relying on Recycle Bin) - so be aware of the security implications. But if you're willing to accept the risk, here is what you can try:
- Prepare the domain controller for isolation
- Disable inbound and outbound replication on the domain controller to ensure changes are not propagated.
- Following isolation, perform metadata clean-up on both sides. Follow https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/ad-ds-metadata-cleanup
- Remove all domain admin accounts except one created specifically for the buyer.
- Remove all servers, computers, and users that do not belong to the location being sold.
- On the PDC Emulator, remove the domain controller associated with the location being sold.
- Clean up DNS entries to remove references to resources not part of the sold location.
- Review/address some of the more obvious security risks
- Built-in Accounts: Accounts like Administrator, Guest, and krbtgt require special handling to mitigate security risks. Reset their password multiple times. For example, for the krbtgt account:
# First Reset Set-ADAccountPassword -Identity krbtgt -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "StrongPassword1!" -Force) # Second Reset Set-ADAccountPassword -Identity krbtgt -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "StrongPassword2!" -Force)
- Built-in Accounts: Accounts like Administrator, Guest, and krbtgt require special handling to mitigate security risks. Reset their password multiple times. For example, for the krbtgt account:
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin