Skip to content
Tech Master Tech Master

OneStopTechnical Forum

  • Books
  • AI
  • Networking
  • Windows
  • Linux
  • Cloud
  • Mac
  • Active Directory
  • Azure
  • Cloud
  • Exchange
  • M365
  • Server 2025
  • Storage
  • Vsphere
  • Website
  • Database
  • Security
  • Knowledge Base
  • VPN
Tech Master
Tech Master

OneStopTechnical Forum

Metadata cleanup in Active Directory

blog.payperitem.com, April 15, 2025April 15, 2025

Performing metadata cleanup in Active Directory is necessary when a domain controller (DC) has been forcefully removed or decommissioned incorrectly, leaving stale references in AD. This can cause replication issues and other problems.

Here’s a step-by-step guide for performing metadata cleanup in Windows Server (applies to Server 2012 and later, including 2019/2022):


✅ 1. Use Active Directory Users and Computers to Remove the DC (if still visible)

Before using command-line tools, try this:

  1. Open Active Directory Users and Computers (dsa.msc).
  2. Navigate to Domain Controllers OU.
  3. If the stale DC is listed, right-click > Delete.
  4. Confirm the deletion and choose “This domain controller is permanently offline” if prompted.

✅ 2. Use ntdsutil for Full Metadata Cleanup

a. Launch ntdsutil:

ntdsutil

b. Enter metadata cleanup:

ntdsutil

metadata cleanup

c. Connect to the correct server:

ntdsutil:

connect to server <YourLiveDCName>

d. Select the domain:

ntdsutil:
select operation target
list domains
select domain <number>

e. Select the site:

ntdsutil:
list sites
select site <number>

f. Select the failed server:

ntdsutil:
list servers in site
select server <number>

g. Remove the selected server:

ntdsutil:quit
remove selected server

h. Quit:

ntdsutil quit
quit

✅ 3. Clean up DNS

Manually remove:

  • A and CNAME records of the old DC.
  • SRV records under zones like:
    • _msdcs.domain.com
    • _sites
    • _tcp
    • _udp

Use DNS Manager (dnsmgmt.msc) to find and delete any leftover records.


✅ 4. Clean up Sites and Services

Open Active Directory Sites and Services (dssite.msc):

  • Expand the site the server belonged to.
  • Expand Servers.
  • If the old server still exists, delete it.
  • Also remove associated NTDS Settings if still present.

✅ 5. Optional – Use PowerShell for Detection

To find orphaned DC metadata:

Get-ADDomainController -Filter * | Select-Object Name,IsGlobalCatalog,IPv4Address,Site


🚨 Things to Watch Out For

  • Never do metadata cleanup on a live/healthy DC.
  • Always verify replication is healthy after: cmdCopyEditrepadmin /replsummary repadmin /showrepl *
  • Backup AD before performing metadata cleanup.

Active Directory Security Server 2025 Windows

Post navigation

Previous post
Next post

Related Posts

Active Directory and Server hardening

April 29, 2025

Active Directory Hardening (Highest Security Level) 1. Tiered Administration Model (Red Forest or ESAE Model) Enforce logon restrictions—Tier 0 accounts must not log in to lower tiers. 2. Secure Domain Controllers 3. Kerberos & NTLM Hardening 4. Admin Account Protection 5. Group Policy (GPO) Hardening 6. Auditing & Monitoring 🖥️…

Read More

Windows update done through script

April 3, 2025April 3, 2025

You can update Windows locally using a PowerShell script. Here’s a script that automates the update process, including checking for updates, installing them, and restarting the system if necessary. PowerShell Script for Local Windows Update powershell# Run as administrator$ErrorActionPreference = “Stop”# Check if running as Administratorfunction Test-Admin { $currentUser =…

Read More

Zentyal as a Domain Controller (Active Directory)- Based on Linux

March 31, 2025April 2, 2025

Zentyal is an easy-to-use Linux server based on Ubuntu that provides essential network services such as domain controller, file sharing, email, firewall, and more. Here’s a step-by-step guide to installing and configuring Zentyal. Step 1: Download and Install Zentyal Step 2: Basic System Configuration Step 3: Configure Network Settings Step…

Read More

Recent Posts

  • List of AD Schema Versions
  • OldNewExplorer Free Download For Windows 11, 10, 8 and 7 [Latest Version]
  • How to Get the Classic (old) Context Menu on Windows 11
  • BitLocker Recovery Keys
  • Active Directory and Server hardening

Recent Comments

No comments to show.
June 2025
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« May    
Log in
©2025 Tech Master | WordPress Theme by SuperbThemes
  • Login
  • Sign Up
Forgot Password?
Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.
body::-webkit-scrollbar { width: 7px; } body::-webkit-scrollbar-track { border-radius: 10px; background: #f0f0f0; } body::-webkit-scrollbar-thumb { border-radius: 50px; background: #dfdbdb }