Microsoft Windows Server: How to Perform an Active Directory Metadata Cleanup
Summary: How to perform a metadata cleanup in Active Directory to remove references to domain controllers that no longer exist in the domain.
Instructions
Clean up server metadata using Active Directory Users and Computers.
- Open Active Directory Users and Computers.
- If you have identified replication partners in preparation for this procedure and if you are not connected to a replication partner of the removed domain controller whose metadata you are cleaning up, right-click Active Directory Users and Computers node, and then click Change Domain Controller. Click the name of the domain controller from which you want to remove the metadata, and then click OK.
- Expand the domain of the domain controller that was forcibly removed, and then click Domain Controllers.
- In the details pane, right-click the computer object of the domain controller whose metadata you want to clean up, and then click Delete.
- In the Active Directory Domain Services dialog box, confirm the name of the domain controller you want to delete, and click Yes to confirm the computer object deletion.
- In the Deleting Domain Controller dialog box, select This Domain Controller is permanently offline and can no longer be demoted using the Active Directory Domain Services Installation Wizard (DCPROMO), and then click Delete.
- If the domain controller is a global catalog server, in the Delete Domain Controller dialog box, click Yes to continue with the deletion.
- If the domain controller holds one or more operations control roles, click OK to move the role or roles to the domain controller that is shown. You cannot change this domain controller. If you want to move the role to a different domain controller, you must move the role after you complete the server metadata cleanup procedure.
Clean up server metadata using Active Directory Sites and Services
- Open Active Directory Sites and Services.
- If you have identified replication partners in preparation for this procedure and if you are not connected to a replication partner of the removed domain controller whose metadata you are cleaning up, right-click Active Directory Sites and Services, and then click Change Domain Controller. Click the name of the domain controller from which you want to remove the metadata, and then click OK.
- Expand the site of the domain controller that was forcibly removed, expand Servers, expand the name of the domain controller, right-click the NTDS Settings object, and then click Delete.
- In the Active Directory Sites and Services dialog box, click Yes to confirm the NTDS Settings deletion.
- In the Deleting Domain Controller dialog box, select This Domain Controller is permanently offline and can no longer be demoted using the Active Directory Domain Services Installation Wizard (DCPROMO), and then click Delete.
- If the domain controller is a global catalog server, in the Delete Domain Controller dialog box, click Yes to continue with the deletion.
- If the domain controller holds one or more operations control roles, click OK to move the role or roles to the domain controller that is shown.
- Right-click the domain controller that was forcibly removed, and then click Delete.
- In the Active Directory Domain Services dialog box, click Yes to confirm the domain controller deletion.
Clean up server metadata using the command line
As an alternative, you can clean up metadata by using ntdsutil.exe, a command-line tool that is installed automatically on all domain controllers and servers that have Active Directory Lightweight Directory Services (AD LDS) installed. ntdsutil.exe is also available on computers that have RSAT installed. To clean up server metadata by using ntdsutil do the following:
-
Open a command prompt as an administrator: On the Start menu, right-click Command Prompt, and then click Run as administrator. If the User Account Control dialog box appears, provide credentials of an Enterprise Administrator if required, and then click Continue.
-
At the command prompt, type the following command, and then press Enter:
ntdsutil
-
At the
ntdsutil:prompt, type the following command, and then press Enter:metadata cleanup
-
At the
metadata cleanup:prompt, type the following command, and then press Enter:remove selected server <ServerName>
-
In Server Remove Configuration Dialog, review the information and warning, and then click Yes to remove the server object and metadata.
Now,
Ntdsutilconfirms that the domain controller was removed successfully. If you receive an error message that indicates that the object cannot be found, the domain controller might have been removed earlier. -
At the
metadata cleanup:andntdsutil:prompts, typequit, and then press Enter. -
To confirm the removal of the domain controller:
Open Active Directory Users and Computers. In the domain of the removed domain controller, click Domain Controllers. In the details pane, an object for the domain controller that you removed should not appear.
Open Active Directory Sites and Services. Navigate to the Servers container and confirm that the server object for the domain controller that you removed does not contain an NTDS Settings object. If no child objects appear below the server object, you can delete the server object. If a child object appears, do not delete the server object because another application is using the object.
Source: https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/deploy/ad-ds-metadata-cleanup
Videos