Active Directory DC Tombstone Recovery

Overview


Recovery of a two-DC domain where one DC was offline longer than the tombstone lifetime (TSL). Replication between the DCs stops with error 8614 and Event 2042, and DFSR stops SYSVOL replication with Event 4012. Applicable to Windows Server 2012 and later. Option B was run end to end in a lab on Hyper-V; the results it produced are noted in each step.

ItemTested scenario
Stale DCHeld all five FSMO roles (PDC Emulator), GC, DNS, and the Microsoft Entra Connect server
Current DCGC, DNS, no roles
Tombstone lifetime180 days, AD Recycle Bin enabled
Days disconnected216
Symptoms8614 in both directions on all five partitions; DFSR 4012 on the stale DC, then on the current DC after a restart
ResultOption B completed: zero lingering objects, replication restored, SYSVOL rebuilt with the current DC authoritative

Microsoft documents two action plans for 8614. Force-demoting the DC may be easier and faster but can lose originating updates made on it. The alternative is to remove lingering objects, remove the replication quarantine and return the DC to service. Microsoft does not describe either option as safer.

MethodSummary
Option B: In-placeKeep the stale DC. Check and remove lingering objects, lift the 8614 quarantine for one cycle, rebuild SYSVOL. No data or roles lost
Option A: RebuildSeize roles to the current DC, remove the stale DC from AD, wipe it and promote a replacement. Changes made only on the stale DC are lost
VariantOption B, then transfer roles and demote the old DC normally. Cleanest end state, slowest

Placeholders and Session Variables


Values in angle brackets are placeholders. Replace them before running anything.

PlaceholderMeaning
<DOMAIN>AD DNS domain name, for example corp.example.com
<DOMAIN-DN>Domain distinguished name, for example DC=corp,DC=example,DC=com
<NETBIOS>Domain NetBIOS name
<STALE-DC>DC that was offline past the TSL
<CURRENT-DC>DC that stayed online
<NEW-DC>Replacement DC (Option A only)
<SITE>AD site name
<ADMIN>Domain admin account
<LAST-SUCCESS-DATE>Last successful replication date from Event 2042, yyyy-MM-dd
<HV-VM-STALE>, <HV-VM-CURRENT>Hyper-V VM names of the two DCs
<VPN-IPV4>, <VPN-IPV6-PREFIX>Addresses of any VPN or overlay adapter on a DC
<NTP-SOURCE>External NTP server for the PDC Emulator

Set these at the start of every PowerShell session on either DC. All later commands use them.

$Domain      = '<DOMAIN>'
$DomainDN    = '<DOMAIN-DN>'
$StaleDC     = '<STALE-DC>'
$CurrentDC   = '<CURRENT-DC>'
$StaleFqdn   = "$StaleDC.$Domain"
$CurrentFqdn = "$CurrentDC.$Domain"
$StaleGuid   = (Get-ADObject (Get-ADDomainController -Identity $StaleDC).NTDSSettingsObjectDN).ObjectGUID.ToString()
$CurrentGuid = (Get-ADObject (Get-ADDomainController -Identity $CurrentDC).NTDSSettingsObjectDN).ObjectGUID.ToString()
$SubStale    = "CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings,CN=$StaleDC,OU=Domain Controllers,$DomainDN"
$SubCurrent  = "CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings,CN=$CurrentDC,OU=Domain Controllers,$DomainDN"
"$StaleDC $StaleGuid"; "$CurrentDC $CurrentGuid"

The two GUIDs are the DSA object GUIDs (NTDS Settings object), which repadmin /removelingeringobjects takes as the reference DC. They must match the DSA object GUID line at the top of repadmin /showrepl <DC> for each DC.

When pasting several commands at once, end each one with Format-List or Format-Table. Without it, PowerShell can lay out a later object using an earlier table’s columns and print blank lines instead of values.

Diagnosis


All checks in this section are read-only.

Confirm the Tombstone Condition


Run on: <STALE-DC>

Confirms replication is blocked by the TSL check, records the date of the last successful replication, and reads the TSL the forest uses.

repadmin /replsummary
repadmin /showrepl $StaleFqdn
netdom query fsmo
Get-ADObject "CN=Directory Service,CN=Windows NT,CN=Services,$((Get-ADRootDSE).configurationNamingContext)" `
  -Properties tombstoneLifetime,msDS-DeletedObjectLifetime | Format-List tombstoneLifetime,msDS-DeletedObjectLifetime
Get-WinEvent -FilterHashtable @{LogName='Directory Service';Id=2042} -MaxEvents 1 | Format-List TimeCreated,Message
Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4012} -MaxEvents 1 | Format-List TimeCreated,Message
FindingMeaning
8614 on every partition, as source and destinationBoth DCs refuse to replicate from each other
Event 2042Shows the last successful replication time and the TSL in effect
tombstoneLifetime blankAttribute not set; the schema default is 60 days. Event 2042 shows the value actually used
Event 4012DFSR stopped SYSVOL because the DC exceeded MaxOfflineTimeInDays (default 60)
All five roles still on <STALE-DC>Option B is still possible. If any role was already seized, use Option A only

Measure the Damage Window


Run on: <CURRENT-DC>

Lingering objects can only exist for objects deleted on the current DC after the last successful replication and already purged by garbage collection. Without the Recycle Bin, purge happens after the TSL. With the Recycle Bin, a deleted object stays for msDS-DeletedObjectLifetime (defaults to the TSL) and then as a recycled object for the TSL, so 360 days with 180-day defaults.

Get-ADOptionalFeature -Filter "Name -eq 'Recycle Bin Feature'" | Format-List Name,EnabledScopes
Get-ADObject -Filter 'isDeleted -eq $true -and name -ne "Deleted Objects"' -IncludeDeletedObjects -Server localhost -Properties whenChanged |
  Sort-Object whenChanged | Select-Object -First 10 Name,whenChanged | Format-Table -AutoSize
ResultExpectation for B1
Recycle Bin enabled before the outage, disconnection shorter than deleted object lifetime plus TSLZero lingering objects (inference). Tested result: zero
Recycle Bin offObjects deleted on the current DC between the last success date and (today minus TSL) may linger

Find Changes Made on Each DC


Run on: each DC

whenChanged is not replicated; each DC sets it when it applies a change. Listing objects changed after the outage on each DC shows what exists only on that DC. Option A discards everything that exists only on the stale DC.

$since = Get-Date '<LAST-SUCCESS-DATE>'
Get-ADObject -Filter 'whenChanged -gt $since' -Server localhost -Properties whenChanged |
  Sort-Object whenChanged | Format-Table Name,ObjectClass,whenChanged -AutoSize

For any object of interest, show which attributes changed, where and when:

$dn = (Get-ADObject -Filter "Name -eq '<OBJECT-NAME>'" -Server localhost).DistinguishedName
repadmin /showobjmeta localhost "$dn" | Select-String '<YYYY-MM>'

On the stale DC, the Security log shows who made group and password changes after it came back online:

Get-WinEvent -FilterHashtable @{LogName='Security';Id=4728,4723,4724;StartTime=$since} -ErrorAction SilentlyContinue |
  Format-List TimeCreated,Id,Message

Tested result: the stale DC held a Domain Admins membership change, a password reset and Entra Connect group writeback that did not exist on the current DC. Option B kept them.

Find Services Tied to the Stale DC


Run on: <STALE-DC>

Roles and applications on the stale DC are lost or broken by Option A. The Entra Connect AD DS connector account (prefix MSOL_) records the server it was installed on in its description.

Get-WindowsFeature | Where-Object { $_.Installed -and $_.FeatureType -eq 'Role' } | Format-Table Name,DisplayName -AutoSize
Get-ADUser -Filter "Name -like 'MSOL_*'" -Server localhost -Properties Description | Format-List Name,Description
Get-GPO -All -Server localhost | Sort-Object ModificationTime -Descending | Select-Object -First 5 DisplayName,ModificationTime | Format-Table -AutoSize

GPMC writes to the PDC Emulator by default. If the stale DC is the PDC and a GPO was edited after it came back, that edit exists only on the stale DC and would be overwritten by a non-authoritative SYSVOL sync. Export it first.

Record SYSVOL State


Run on: each DC

Decides the SYSVOL path in B5. Repeat this immediately before B5: in the tested run the current DC was at state 4 during diagnosis and logged 4012 after the checkpoint restart.

Get-CimInstance -Namespace root\microsoftdfs -ClassName DfsrReplicatedFolderInfo |
  Where-Object ReplicatedFolderName -eq 'SYSVOL share' | Format-Table ReplicatedFolderName,State -AutoSize
Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4012} -MaxEvents 1 -ErrorAction SilentlyContinue | Format-List TimeCreated
net share | Select-String 'SYSVOL|NETLOGON'
StateMeaning
0Uninitialized
1Initialized
2Initial Sync
3Auto Recovery
4Normal
5In Error

Choosing a Method


ItemOption B: In-PlaceOption A: Rebuild
FSMO rolesStay on the stale DCSeized to the current DC
Changes made only on the stale DCKeptLost
Stale DC server and its applicationsKeptWiped
Lingering objectsChecked and removedDiscarded with the database
Metadata and DNS cleanupNot neededRequired
ReversibleYes, until a role is seizedNo
ConditionUse
Any role already seized, or the stale DC deleted from ADOption A only. A DC whose roles were seized must not return
Stale DC hosts Entra Connect, AD CS or other services, or holds changes that are neededOption B
Stale DC holds nothing uniqueEither. Option A is Microsoft’s easier and faster route
Lab with checkpoints of both DCsOption B first; revert both checkpoints and use Option A if it fails

Choose before seizing any role: seizure rules out Option B permanently.

Pre-flight Checks


Read-only checks that must pass before Option B. They also apply to Option A when the stale DC is still running.

Name Resolution and Extra Adapters


Run on: each DC, with $Partner set to the other DC

A DC with a VPN or overlay adapter (Tailscale in the tested run) can resolve names through the VPN client’s DNS and register VPN addresses in AD DNS. Partners and clients then receive addresses they may not reach, and replication can fail intermittently.

$Partner = '<PARTNER-DC-FQDN>'
Get-NetIPAddress -AddressFamily IPv4 | Where-Object IPAddress -ne '127.0.0.1' | Format-Table InterfaceAlias,IPAddress -AutoSize
Get-DnsClientServerAddress | Format-Table InterfaceAlias,AddressFamily,ServerAddresses -AutoSize
Resolve-DnsName $Partner -Type A_AAAA | Format-Table Name,Type,IPAddress -AutoSize
nltest /dsgetdc:$Domain /pdc /force
$r = foreach ($ip in (Resolve-DnsName $Partner -Type A_AAAA | Where-Object IPAddress).IPAddress) {
  foreach ($p in 53,88,135,389,445) {
    Test-NetConnection $ip -Port $p -WarningAction SilentlyContinue | Select-Object RemoteAddress,RemotePort,TcpTestSucceeded
  }
}
$r | Format-Table -AutoSize

Expected: the partner resolves, nltest returns the PDC, and every returned address answers on all ports.

Tested result: Resolve-DnsName failed on the current DC with “Not enough memory resources are available”, nltest returned 1355 and repadmin /bind returned LDAP error 81. Cause: the Tailscale client’s DNS was enabled on that DC. Disabling it fixed resolution immediately:

& 'C:\Program Files\Tailscale\tailscale.exe' set --accept-dns=false
ipconfig /flushdns

Registered VPN addresses do not block recovery as long as every address returned is reachable. Clean them up afterwards (Post-Recovery Tasks).

Kerberos Between the DCs


Run on: each DC, same session as the previous check (uses $Partner)

Replication and lingering object removal need Kerberos between the DCs. A DC accepts tickets encrypted with its current or previous machine password, so the copies of each DC’s computer account password on the two DCs must be at most one version apart (inference). Microsoft documents that password changes are sent immediately to the PDC Emulator outside normal replication, and that this can fail silently, so versions can differ in unexpected ways.

repadmin /bind $Partner | Select-String 'succeeded|failed|error'
klist | Select-String 'Server:'
foreach ($c in $StaleDC,$CurrentDC) {
  $dn = (Get-ADComputer $c -Server localhost).DistinguishedName
  "== $c =="; repadmin /showobjmeta localhost "$dn" | Select-String 'unicodePwd'
}

Expected: the bind succeeds with a ticket for ldap/<partner>, and the unicodePwd version (column before the attribute name) for each DC differs by no more than one between the two DCs’ outputs.

If the bind fails with -2146893022 (target principal name is incorrect), the failing DC’s KDC holds a stale password for its partner. Make the failing DC use its partner’s KDC and reset its own password against the partner:

Set-Service -Name KDC -StartupType Disabled; Stop-Service -Name KDC
klist -li 0x3e7 purge; klist purge
netdom resetpwd /server:$Partner /userd:<NETBIOS>\<ADMIN> /passwordd:*
# After B4 succeeds:
Set-Service -Name KDC -StartupType Automatic; Start-Service -Name KDC

Tested result: not needed. Both directions authenticated.

Replication Registry Keys


Run on: each DC

Get-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Services\NTDS\Parameters' |
  Format-List 'Strict Replication Consistency','Allow Replication With Divergent and Corrupt Partner'

Expected: Strict Replication Consistency : 1 and no divergent-partner value. If the divergent-partner value is already set, find out why before continuing.

Preparation


Pause Entra Connect


Run on: the Entra Connect server (the stale DC in the tested run)

Stops the sync exporting a half-recovered directory to Entra ID. Microsoft’s procedure for configuration changes is to disable the scheduler and confirm no sync is running.

Stop-ADSyncSyncCycle
Set-ADSyncScheduler -SyncCycleEnabled $false
Get-ADSyncScheduler | Format-List SyncCycleEnabled
Get-ADSyncConnectorRunStatus

Expected: SyncCycleEnabled : False and no output from Get-ADSyncConnectorRunStatus.

Add a Backup Volume


A system state backup needs a target other than the system volume: a drive letter, a volume GUID, or a network share (-backupTarget:\\server\share\). Skip this if either exists. On Hyper-V Generation 2 VMs a disk can be added to the SCSI controller while the VM runs.

Run on: Hyper-V host

$vms = '<HV-VM-STALE>','<HV-VM-CURRENT>'
$dir = (Get-VMHost).VirtualHardDiskPath
foreach ($vm in $vms) {
  $vhd = Join-Path $dir "$vm-Backup.vhdx"
  New-VHD -Path $vhd -SizeBytes 40GB -Dynamic | Out-Null
  Add-VMHardDiskDrive -VMName $vm -ControllerType SCSI -Path $vhd
}
Get-VMHardDiskDrive -VMName $vms | Format-Table VMName,ControllerLocation,Path -AutoSize

Run on: each DC. Confirm the new disk number with Get-Disk first (40 GB, RAW, usually offline).

$n = <DISK-NUMBER>
Set-Disk -Number $n -IsOffline $false
Set-Disk -Number $n -IsReadOnly $false
Initialize-Disk -Number $n -PartitionStyle GPT
New-Partition -DiskNumber $n -DriveLetter E -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel 'SSBackup' -Confirm:$false

Selecting the disk by number rather than by filter avoids formatting the wrong disk.

System State and SYSVOL Backups


Run on: each DC

The system state backup is the supported restore point for AD. The SYSVOL copy keeps a plain file copy of the policies, because a SYSVOL rebuild moves differing files to PreExisting or ConflictAndDeleted.

Install-WindowsFeature Windows-Server-Backup
wbadmin start systemstatebackup -backupTarget:E: -quiet
wbadmin get versions -backupTarget:E:
robocopy C:\Windows\SYSVOL\domain "E:\SYSVOL-$env:COMPUTERNAME" /E /B /COPYALL /R:0 /W:0 /XD DfsrPrivate

Expected: backup completes, one version listed, robocopy FAILED column 0.

Checkpoint Both DCs


Run on: Hyper-V host

List existing checkpoints first. Any checkpoint from before the outage must not be applied: Microsoft does not support snapshots as an AD restore method. On a Server 2012+ DC, applying one triggers VM-GenerationID safeguards (new invocation ID, RID pool discarded, non-authoritative SYSVOL sync).

Get-VMSnapshot -VMName '<HV-VM-STALE>','<HV-VM-CURRENT>' | Format-Table VMName,Name,CreationTime -AutoSize

Shut both down so the two checkpoints are consistent with each other, checkpoint, then start the stale DC first:

Stop-VM -Name '<HV-VM-STALE>','<HV-VM-CURRENT>'
Checkpoint-VM -Name '<HV-VM-STALE>','<HV-VM-CURRENT>' -SnapshotName 'Pre-TombstoneRecovery'
Start-VM -Name '<HV-VM-STALE>'; Start-Sleep -Seconds 120; Start-VM -Name '<HV-VM-CURRENT>'

This is the lab rollback point. Revert both checkpoints together, never one.

Option B: In-Place Recovery


Run as a member of Domain Admins in an elevated session. Order matters: lingering objects, then quarantine, then SYSVOL.

B1: Lingering Object Check


Run on: <STALE-DC>, then the reverse on <CURRENT-DC>. Changes: none (advisory mode).

Compares every object on the target DC with the reference DC and logs any that the reference no longer holds. The namingContexts list covers every partition the DC holds (single-domain forest; in a multi-domain forest each partition needs a reference DC holding a writable copy).

foreach ($nc in (Get-ADRootDSE -Server $StaleFqdn).namingContexts) {
  "--- $nc ---"; repadmin /removelingeringobjects $StaleFqdn $CurrentGuid $nc /advisory_mode
}

Reverse check, run on the current DC:

foreach ($nc in (Get-ADRootDSE -Server $CurrentFqdn).namingContexts) {
  "--- $nc ---"; repadmin /removelingeringobjects $CurrentFqdn $StaleGuid $nc /advisory_mode
}

Read the results on the DC the check ran against. The events can arrive a few seconds after repadmin returns (observed in testing), so wait before reading them:

Start-Sleep -Seconds 30
Get-WinEvent -FilterHashtable @{LogName='Directory Service';Id=1942,1946} -MaxEvents 10 -ErrorAction SilentlyContinue |
  Sort-Object TimeCreated |
  Format-Table TimeCreated,Id,@{n='Count';e={($_.Message -split "`r?`n" | Where-Object { $_ -match '^\s*\d+\s*$' } | Select-Object -Last 1).Trim()}} -AutoSize
EventMeaning
1938Verification started (one per partition)
1946One per lingering object found
1942Verification completed, with the number of lingering objects

Expected: RemoveLingeringObjects successful for each partition, five 1942 events, no 1946. Tested result: 0 in both directions. If both are 0, skip B2.

B2: Remove Lingering Objects


Run on: the DC that logged 1946. Changes: deletes the listed objects.

Only if B1 found objects. Same loop without /advisory_mode; each removed object logs Event 1945. Re-run B1 afterwards and continue only when it returns 0.

foreach ($nc in (Get-ADRootDSE -Server $StaleFqdn).namingContexts) {
  "--- $nc ---"; repadmin /removelingeringobjects $StaleFqdn $CurrentGuid $nc
}

Objects reported within the rolling 12-hour garbage collection window are transient and need no action.

B3: Lift the Replication Quarantine


Run on: <STALE-DC>. Changes: registry on both DCs, then replication.

The divergent-partner key lets a destination DC replicate from a partner past the TSL. It goes on every DC that logs 8614 as destination, which was both. Strict mode stays on so a missed lingering object blocks replication instead of being reintroduced.

foreach ($dc in $StaleFqdn,$CurrentFqdn) {
  repadmin /regkey $dc +strict
  repadmin /regkey $dc +allowDivergent
}
repadmin /syncall $CurrentDC /AdeP
repadmin /syncall $StaleDC /AdeP
repadmin /replsummary

/syncall flags: /A all partitions, /d distinguished names in output, /e all sites, /P push changes outward from the named DC.

Expected: every partition reports SyncAll terminated with no errors, and /replsummary shows 0 / 5 failures for both DCs as source and destination. Error 8606 or Event 1988 means a missed lingering object; see Troubleshooting.

B4: Restore Protection


Run on: <STALE-DC>. Changes: registry on both DCs.

After one successful cycle, remove the override so the TSL check applies again.

foreach ($dc in $StaleFqdn,$CurrentFqdn) { repadmin /regkey $dc -allowDivergent }
repadmin /replsummary

Expected: each DC reports the value does not exist, and replication still shows 0 / 5 failures.

B5: SYSVOL Recovery


DFSR reads its configuration from AD, so AD replication must be healthy first. Re-check SYSVOL state on both DCs (Record SYSVOL State) and pick the path:

Condition nowPath
Only the stale DC logged 4012; current DC at state 4B5A: non-authoritative sync on the stale DC
Both DCs logged 4012B5B: current DC authoritative, stale DC non-authoritative

Microsoft prefers the PDC Emulator as the authoritative member because it is usually the most current. Here the PDC is the stale DC, so the current DC holds the current policy content (inference). If B5A leaves the stale DC at state 2 with Event 4614 and no 4604, and the current DC’s inbound connection from the stale DC is Offline, the current DC has hit 4012 as well: use B5B. This is what happened in testing.

dfsrdiag is part of the DFS management tools. If missing: Install-WindowsFeature RSAT-DFS-Mgmt-Con.

B5A: Non-Authoritative Sync on the Stale DC


Run on: <STALE-DC>. Changes: SYSVOL on the stale DC is replaced from the current DC.

Disabling the subscription makes DFSR drop the folder (Event 4114). Re-enabling it starts an initial sync from the partner (4614, then 4604).

Set-ADObject $SubStale -Server $StaleFqdn -Replace @{'msDFSR-Enabled'=$false}
repadmin /syncall $StaleDC /AdeP | Select-String 'terminated'
dfsrdiag pollad
Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4114} -MaxEvents 1 | Format-List TimeCreated

After 4114 appears:

Set-ADObject $SubStale -Server $StaleFqdn -Replace @{'msDFSR-Enabled'=$true}
repadmin /syncall $StaleDC /AdeP | Select-String 'terminated'
dfsrdiag pollad
Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4614,4604} -MaxEvents 2 | Format-Table TimeCreated,Id -AutoSize

B5B: Authoritative Sync from the Current DC


Tested path. Each step waits for an event before the next one.

1. Stop DFSR on both DCs. Manual startup stops it restarting before the AD changes are in place.

# On each DC
Set-Service DFSR -StartupType Manual; Stop-Service DFSR

2. Mark the current DC authoritative and disable the stale DC’s subscription. Run on the stale DC; the push and read-back confirm the current DC sees the change.

Set-ADObject $SubCurrent -Server $StaleFqdn -Replace @{'msDFSR-Enabled'=$false;'msDFSR-Options'=1}
Set-ADObject $SubStale   -Server $StaleFqdn -Replace @{'msDFSR-Enabled'=$false}
repadmin /syncall $StaleDC /AdeP | Select-String 'terminated'
Get-ADObject $SubCurrent -Server $CurrentFqdn -Properties msDFSR-Enabled,msDFSR-Options | Format-List msDFSR-Enabled,msDFSR-Options
Get-ADObject $SubStale   -Server $CurrentFqdn -Properties msDFSR-Enabled | Format-List msDFSR-Enabled

Expected: False and 1 for the current DC, False for the stale DC.

3. Start DFSR on the current DC and wait for 4114. Run on the current DC. This loop is reused below with a different event ID and the same variable names.

$t0 = Get-Date
Start-Service DFSR
do {
  Start-Sleep -Seconds 15
  $e = Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4114;StartTime=$t0} -MaxEvents 1 -ErrorAction SilentlyContinue
} until ($e -or ((Get-Date) - $t0).TotalMinutes -ge 10)
if ($e) { $e | Format-List TimeCreated } else { 'No 4114 after 10 minutes' }

4. Enable the current DC as the primary member and wait for 4602. Run on the current DC.

Set-ADObject $SubCurrent -Server localhost -Replace @{'msDFSR-Enabled'=$true}
repadmin /syncall $CurrentDC /AdeP | Select-String 'terminated'
$t0 = Get-Date; dfsrdiag pollad
do {
  Start-Sleep -Seconds 15
  $e = Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4602;StartTime=$t0} -MaxEvents 1 -ErrorAction SilentlyContinue
} until ($e -or ((Get-Date) - $t0).TotalMinutes -ge 10)
if ($e) { $e | Format-List TimeCreated } else { 'No 4602 after 10 minutes' }
net share | Select-String 'SYSVOL|NETLOGON'

Expected: 4602 (“designated primary member”), state 4, SYSVOL and NETLOGON shared.

5. Start DFSR on the stale DC and wait for 4114. Run step 3’s loop on the stale DC.

6. Enable the stale DC and wait for 4604. Run on the stale DC.

Set-ADObject $SubStale -Server $StaleFqdn -Replace @{'msDFSR-Enabled'=$true}
repadmin /syncall $StaleDC /AdeP | Select-String 'terminated'
$t0 = Get-Date; dfsrdiag pollad
do {
  Start-Sleep -Seconds 15
  $e = Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4604;StartTime=$t0} -MaxEvents 1 -ErrorAction SilentlyContinue
} until ($e -or ((Get-Date) - $t0).TotalMinutes -ge 15)
Get-WinEvent -FilterHashtable @{LogName='DFS Replication';Id=4614,4604;StartTime=$t0} -ErrorAction SilentlyContinue | Format-Table TimeCreated,Id -AutoSize

Expected: 4614 then 4604 within a few minutes, state 4.

7. Restore automatic startup and confirm the DFSR connections. Run on the stale DC.

Set-Service DFSR -StartupType Automatic
Set-Service DFSR -ComputerName $CurrentDC -StartupType Automatic
Get-Service DFSR -ComputerName $StaleDC,$CurrentDC | Format-Table MachineName,Status,StartType -AutoSize
Get-CimInstance -Namespace root\microsoftdfs -ClassName DfsrConnectionInfo | Format-Table PartnerName,Inbound,State -AutoSize
net share | Select-String 'SYSVOL|NETLOGON'

Expected: DFSR Running and Automatic on both; both connections state 1 (0 Connecting, 1 Online, 2 Offline, 3 In Error); both shares present. If anything is needed from the old content, it is in the backup copies or PreExisting / ConflictAndDeleted.

B6: Time Source


Run on: Hyper-V host, then each DC

For DC VMs, Microsoft recommends turning off Hyper-V time synchronization (VM off first) and letting the DC use the domain time hierarchy. In the tested run the current DC took its time from the host instead of the PDC. One VM at a time keeps a DC online:

foreach ($vm in '<HV-VM-CURRENT>','<HV-VM-STALE>') {
  Stop-VM -Name $vm
  Disable-VMIntegrationService -VMName $vm -Name 'Time Synchronization'
  Start-VM -Name $vm
  Start-Sleep -Seconds 180
}
Get-VMIntegrationService -VMName '<HV-VM-STALE>','<HV-VM-CURRENT>' -Name 'Time Synchronization' | Format-Table VMName,Enabled -AutoSize

Current DC follows the domain hierarchy:

w32tm /config /syncfromflags:domhier /reliable:no /update
Restart-Service w32time
w32tm /resync /rediscover
w32tm /query /source

PDC Emulator (the stale DC) uses an external source and advertises as reliable:

w32tm /config /manualpeerlist:"<NTP-SOURCE>,0x8" /syncfromflags:manual /reliable:yes /update
Restart-Service w32time
w32tm /resync /rediscover
w32tm /query /source
w32tm /query /configuration | Select-String 'Type:|AnnounceFlags'

Expected: integration service False on both VMs; the current DC’s source is the PDC; the PDC shows <NTP-SOURCE>, Type: NTP, AnnounceFlags: 5.

B7: Verify


Run on: <STALE-DC>

repadmin /replsummary
repadmin /showrepl * /csv | ConvertFrom-Csv |
  Select-Object 'Destination DSA','Source DSA','Naming Context','Number of Failures','Last Failure Status' | Format-Table -AutoSize
netdom query fsmo
dcdiag /e /c /q

dcdiag /q prints errors only. Results seen in testing that are not replication faults:

dcdiag resultMeaning
DFSREvent failed on both DCsRecovery events (4012, 4614) within the last 24 hours. Clears on its own
Event 2505, “another computer on the network has the same name”NetBIOS clash on an extra adapter (inference). See Post-Recovery Tasks
luafv failed to startUAC file virtualization driver, not AD
Event 1801, Secure Boot certificates not appliedVM firmware update, not AD

Functional test: create on the current DC, delete on the stale DC, confirm both changes replicate:

New-ADUser -Name 'ReplTest01' -Server $CurrentFqdn -Enabled $false
repadmin /syncall $CurrentDC /AdeP | Select-String 'terminated'
Get-ADUser -Filter "Name -eq 'ReplTest01'" -Server $StaleFqdn | Format-Table Name -AutoSize
Remove-ADUser -Identity 'ReplTest01' -Server $StaleFqdn -Confirm:$false
repadmin /syncall $StaleDC /AdeP | Select-String 'terminated'
Get-ADUser -Filter "Name -eq 'ReplTest01'" -Server $CurrentFqdn | Format-Table Name -AutoSize
Get-ADObject -Filter "Name -like 'ReplTest01*'" -IncludeDeletedObjects -Server $CurrentFqdn | Format-Table Name,Deleted -AutoSize

Expected: user listed on the stale DC after creation; nothing live on the current DC after deletion; one deleted object with Deleted : True (Recycle Bin).

B8: Resume Entra Connect


Run on: the Entra Connect server

Set-ADSyncScheduler -SyncCycleEnabled $true
Start-ADSyncSyncCycle -PolicyType Delta
Start-Sleep -Seconds 120
Get-ADSyncScheduler | Format-List SyncCycleEnabled,NextSyncCycleStartTimeInUTC
Get-ADSyncConnectorRunStatus

Expected: SyncCycleEnabled : True, the next cycle about 30 minutes out (the default interval), and no run in progress. Check the Operations tab in Synchronization Service Manager for success.

Option A: Rebuild (Seize and Replace)


Use when the stale DC holds nothing that is needed, or when any role has already been seized. Changes made only on the stale DC are lost. If the stale DC hosts Entra Connect or AD CS, move those services first. All steps run on <CURRENT-DC> unless stated.

A1. Back up and isolate the stale DC. Take the backups and checkpoint in Preparation, then shut the stale DC down and disconnect its network adapter. Seizing roles while the original holder is on the network creates conflicts.

A2. Seize the FSMO roles. Seizure first attempts a transfer and waits for it to time out. Requires Schema Admins and Enterprise Admins.

Move-ADDirectoryServerOperationMasterRole -Identity $CurrentDC -Server $CurrentFqdn `
  -OperationMasterRole SchemaMaster,DomainNamingMaster,PDCEmulator,RIDMaster,InfrastructureMaster -Force -Confirm:$false
netdom query fsmo

A3. Remove the stale DC’s metadata. Deleting the DC object in Active Directory Users and Computers performs the full metadata cleanup (confirm “This Domain Controller is permanently offline…”):

dsa.msc > <DOMAIN> > Domain Controllers > <STALE-DC> > Delete

Check nothing is left. An empty server object in Sites and Services can be deleted; if it still has an NTDS Settings child, leave it.

Get-ADComputer -Filter "Name -eq '$StaleDC'" -Server $CurrentFqdn
Get-ADObject -SearchBase "CN=Sites,CN=Configuration,$DomainDN" -Filter "Name -eq '$StaleDC'" -Server $CurrentFqdn | Format-Table DistinguishedName,ObjectClass

A4. Remove the stale DC’s DNS records. Review the list, then remove.

$ip = '<STALE-DC-IP>'
foreach ($zone in $Domain,"_msdcs.$Domain") {
  $recs = Get-DnsServerResourceRecord -ZoneName $zone | Where-Object {
    $_.RecordData.IPv4Address   -eq $ip              -or
    $_.RecordData.DomainName    -like "$StaleDC.*"   -or
    $_.RecordData.NameServer    -like "$StaleDC.*"   -or
    $_.RecordData.HostNameAlias -like "$StaleDC.*"   -or
    $_.HostName                 -like "$StaleGuid*"
  }
  "--- $zone ---"; $recs | Format-Table HostName,RecordType -AutoSize
  # $recs | Remove-DnsServerResourceRecord -ZoneName $zone -Force
}

Also check reverse zones, DHCP option 006 and static DNS settings that point at the stale DC.

A5. Rebuild SYSVOL on the current DC if it logged 4012. With a single DC, the sync must be authoritative:

Stop-Service DFSR
Set-ADObject $SubCurrent -Server localhost -Replace @{'msDFSR-Enabled'=$false;'msDFSR-Options'=1}
Start-Service DFSR    # wait for 4114
Set-ADObject $SubCurrent -Server localhost -Replace @{'msDFSR-Enabled'=$true}
dfsrdiag pollad       # wait for 4602
net share | Select-String 'SYSVOL|NETLOGON'

A6. Time source and RID pool. The current DC is now PDC Emulator: configure it as in B6 for the PDC. Check the RID pool; Microsoft’s forest recovery procedure raises rIDAvailablePool by 100,000 as a precaution.

dcdiag /s:$CurrentDC /test:ridmanager /v | Select-String 'Available RID Pool'

A7. Promote a replacement DC. Wipe the old server; never reuse its database. A new name is recommended, and reusing the old IP avoids client DNS changes. See Replacement DC Promotion Methods.

A8. Verify. Run the B7 checks. Expected: no 8614 or 2042, all roles on the current DC, the new DC logs 4614 then 4604.

Variant: In-Place Repair Then Graceful Removal


Use when the stale DC should be retired but seizure and forced removal should be avoided.

  1. Complete Option B. A graceful role transfer synchronizes the role owner’s data to the target before the role moves, so replication must work first.
  2. Transfer (not seize) the roles:
Move-ADDirectoryServerOperationMasterRole -Identity $CurrentDC -Server $CurrentFqdn `
  -OperationMasterRole SchemaMaster,DomainNamingMaster,PDCEmulator,RIDMaster,InfrastructureMaster
  1. Move the external time source to the new PDC (B6) and return the old one to domhier.
  2. Move Entra Connect or other services off the old DC.
  3. Demote it normally (removes its own metadata, so A3 is not needed):
Uninstall-ADDSDomainController -Credential (Get-Credential '<NETBIOS>\<ADMIN>') `
  -LocalAdministratorPassword (Read-Host -AsSecureString 'New local admin password')
  1. Review DNS for leftover records (A4 query), then promote a replacement and verify (B7).

Replacement DC Promotion Methods


MethodUse whenKey requirements
Network replicationDefault; small or well-connected directoryA healthy writable DC reachable on the network
Install From Media (IFM)Large directory or slow linkMedia from a writable DC on the same OS version; cannot be used for the first DC in a domain
Virtualized DC cloningFast copy of an existing virtual DCPDC Emulator online on Server 2012 or later; source DC in Cloneable Domain Controllers; all applications on the source cloneable

Prepare the new server first in every case: static IP, DNS pointing at <CURRENT-DC>, joined to the domain (not needed for cloning).

Network Replication


Run on: <NEW-DC>

Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-ADDSDomainController -DomainName $Domain -InstallDns -SiteName '<SITE>' `
  -ReplicationSourceDC $CurrentFqdn -Credential (Get-Credential '<NETBIOS>\<ADMIN>')

Install From Media


Run on: <CURRENT-DC> to create the media, then copy the folder to <NEW-DC>.

ifm create sysvol full writes a copy of the AD database, registry and SYSVOL that the new DC loads instead of replicating everything over the network.

ntdsutil "activate instance ntds" ifm "create sysvol full C:\IFM" quit quit

Run on: <NEW-DC>

Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-ADDSDomainController -DomainName $Domain -InstallDns -SiteName '<SITE>' `
  -InstallationMediaPath 'C:\IFM' -Credential (Get-Credential '<NETBIOS>\<ADMIN>')

Delete the IFM folder afterwards: it contains a copy of the directory database.

Virtualized DC Cloning


Run on: the source DC (<CURRENT-DC>)

Authorise the source, check for applications that cannot be cloned, then write the clone configuration. New-ADDCCloneConfigFile runs the prerequisite checks and only writes DCCloneConfig.xml if they pass.

Add-ADGroupMember -Identity 'Cloneable Domain Controllers' -Members (Get-ADComputer $CurrentDC)
Get-ADDCCloningExcludedApplicationList
# Only after confirming every listed application is safe to clone:
Get-ADDCCloningExcludedApplicationList -GenerateXml
New-ADDCCloneConfigFile -CloneComputerName '<NEW-DC>' -Static -IPv4Address '<NEW-DC-IP>' `
  -IPv4SubnetMask '<MASK>' -IPv4DefaultGateway '<GATEWAY>' -IPv4DNSResolver '<CURRENT-DC-IP>' -SiteName '<SITE>'

Run on: Hyper-V host

The source must be shut down while its disk is copied and running when the clone first starts. With only one DC left after Option A, that means a short period with no DC online.

Stop-VM -Name '<HV-VM-CURRENT>'
Export-VM -Name '<HV-VM-CURRENT>' -Path '<EXPORT-PATH>'
Start-VM -Name '<HV-VM-CURRENT>'
$vmcx  = Get-ChildItem "<EXPORT-PATH>\<HV-VM-CURRENT>\Virtual Machines\*.vmcx" | Select-Object -First 1
$clone = Import-VM -Path $vmcx.FullName -Copy -GenerateNewId -VirtualMachinePath '<NEW-VM-PATH>' -VhdDestinationPath '<NEW-VM-PATH>'
Rename-VM -VM $clone -NewName '<NEW-DC>'
Start-VM -Name '<NEW-DC>'

Afterwards remove the source from Cloneable Domain Controllers and delete the export.

Troubleshooting


SymptomCauseAction
Resolve-DnsName fails with “Not enough memory resources”, nltest 1355, repadmin /bind LDAP 81 Server DownDC resolving through a VPN client’s DNS (tested: Tailscale)Disable the VPN client’s DNS on the DC, ipconfig /flushdns, retest
Partner resolves to VPN addresses; DC locator returns a VPN addressDNS Server service listens on, and Netlogon registers, every addressWorks while all addresses are reachable; clean up after recovery
tombstoneLifetime prints blankOutput formatting when commands are pasted togetherRe-run with Format-List
Advisory run successful but no 1942/1946 events foundEvents written shortly after repadmin returnsWait, then read the latest events
-2146893022 target principal name is incorrectKDC holds a stale machine password for the partnerKerberos Between the DCs
8614 persists after +allowDivergentKey on the wrong DCSet it on the destination DC that logs 8614
8606 or Event 1988 after B3Missed lingering object. Microsoft: the object is on the source DC named in 1988Run B1/B2 with that source DC as the target, for that partition
SYSVOL stuck at state 2 / 4614, no errors, partner inbound connection OfflinePartner also logged 4012B5B
Get-WinEvent “The parameter is incorrect” with ProviderNameProvider filter rejectedFilter by Id and pipe to Where-Object ProviderName -like ...
dcdiag DFSREvent failureRecovery events in the last 24 hoursRe-run dcdiag the next day

Methods Not Used


MethodReason
+allowDivergent without checking lingering objectsMicrosoft: check and remove lingering objects in each partition before setting the key, even with strict mode on
Raising tombstoneLifetimeTombstones already purged stay purged; this only bypasses the age check (inference)
Raising MaxOfflineTimeInDays on the stale DCWould let stale SYSVOL content be treated as current (inference); the documented fix is a non-authoritative or authoritative sync
Applying a pre-outage checkpointNot a supported AD restore method; triggers VM-GenerationID safeguards

Post-Recovery Tasks


TaskDetail
VPN adapter DNS recordsRemove VPN addresses from AD DNS on each DC (inventory below). To stop them returning, either set the DNS Server to listen on the LAN address only and suppress Netlogon’s domain and GC A records (DnsAvoidRegisterRecords: LdapIpAddress, GcIpAddress) with static LAN records added by hand, or remove the VPN client from the DCs and reach the network through a VPN subnet router on another host
NetBIOS on the VPN adapterIdentify the adapter from the transport GUID in Event 2505 and disable NetBIOS over TCP/IP on it (commands below)
Windows FirewallIt was found disabled on a DC; re-enable it with the AD DS rules
CheckpointsDelete the recovery checkpoint once stable. Delete pre-outage checkpoints rather than keeping them where they can be applied by mistake
Backup disksKeep for scheduled system state backups or remove from the VMs
MonitoringAlert on replication failures at 50 and 90 percent of the TSL, and well before 60 days for DFSR
Secure Boot certificates (Event 1801)Separate firmware update task

Inventory of VPN and link-local records on one DC’s copy of the zones (run on each DC; they hold separate copies until replication resumes):

$badV4 = '<VPN-IPV4>'
foreach ($z in $Domain,"_msdcs.$Domain") {
  Get-DnsServerResourceRecord -ZoneName $z | Where-Object {
    ($_.RecordType -eq 'A'    -and $badV4 -contains $_.RecordData.IPv4Address.IPAddressToString) -or
    ($_.RecordType -eq 'AAAA' -and $_.RecordData.IPv6Address.IPAddressToString -match '^(<VPN-IPV6-PREFIX>|fe80:)')
  } | Format-Table @{n='Zone';e={$z}},HostName,RecordType,
      @{n='Data';e={ if ($_.RecordType -eq 'A') { $_.RecordData.IPv4Address } else { $_.RecordData.IPv6Address } }},Timestamp -AutoSize
}

Records with a timestamp come from Netlogon, which re-registers them hourly; records without one come from the DNS Server service.

Identify the adapter named by the transport GUID in Event 2505, then disable NetBIOS over TCP/IP on it (SetTcpipNetbios value 2 = disabled):

Get-NetAdapter | Where-Object InterfaceGuid -eq '{<TRANSPORT-GUID>}' | Format-Table Name,InterfaceDescription -AutoSize
Get-CimInstance Win32_NetworkAdapterConfiguration -Filter "SettingID='{<TRANSPORT-GUID>}'" |
  Invoke-CimMethod -MethodName SetTcpipNetbios -Arguments @{TcpipNetbiosOptions=2}

Key Rules


RuleReason
Choose the method before seizing any roleSeizure assumes the original holder never returns, which rules out Option B
Back up and checkpoint both DCs togetherReverting one DC alone puts the pair out of step
Check lingering objects before setting +allowDivergentThe quarantine exists to force this check
Keep strict replication onA missed lingering object blocks replication instead of reappearing
Remove allowDivergent after one successful cycleRestores the TSL protection
Repair AD replication before SYSVOLDFSR reads its configuration from AD
Re-check DFSR state on both DCs right before B5The current DC can hit 4012 once DFSR sees its partner again
Pause directory sync during recoveryPrevents exporting a half-recovered directory
Fix DC name resolution firstVPN client DNS on a DC breaks DC location, LDAP binds and password forwarding