Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

DFSR event 4012: replication stopped because it failed for longer than MaxOfflineTimeInDays

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

Event 4012 in the DFS Replication log means content freshness protection has stopped replication of a folder on this server. Microsoft describes the event as showing that replication of the folder has stopped because replication has failed for longer than the MaxOfflineTimeInDays parameter. The server can be online and still log it, and it will not rejoin until you recover it on purpose.

The fix is a decision before it is a command: work out which copy of the data is good, back up the stale copy, then let the server resynchronise from a healthy partner. For SYSVOL on a domain controller, Microsoft's method is a set of ADSI Edit changes, given below. Raising the limit to silence the error is a different decision, because it lets the old copy take part in replication again.

What the error means

Microsoft's SYSVOL troubleshooting page says content freshness is enabled on Windows Server 2012 and later domain controllers by default, that MaxOfflineTimeInDays is then 60, and that it is 0 when content freshness is disabled. It may also be enabled by hand on Windows Server 2008 R2. For SYSVOL, the page lists the folder state values as 0 = Uninitialized, 1 = Initialized, 2 = Initial Sync, 3 = Auto Recovery, 4 = Normal and 5 = In Error.

Two limits. The page that names event 4012 is a SYSVOL page, so its recovery steps are for domain controllers; it does not print the event's full wording, so read the event on your server for the folder path and group name. And no page cited here gives a 4012 procedure for a custom (non-SYSVOL) replicated folder; that case is covered separately below with its limits.

Event 4012 is not the dirty-shutdown pause, which is event 2213. If content freshness was not triggered, Microsoft's page resumes replication with the ResumeReplication method. If it was triggered, you recover non-authoritatively.

Likely causes

Cause What you see How to confirm
Replication of the folder failed for longer than the limit (member off, disconnected or unable to replicate) Event 4012 on that member; SYSVOL state 5 Compare the last good replication with MaxOfflineTimeInDays
Every domain controller has logged 4012 All members in state 5; no healthy source Run the state query on each domain controller
A new domain controller never finished initial synchronisation Event 4614 without 4604; SYSVOL not shared Look for 4614 and 4604; Microsoft pairs them
A different fault: dirty shutdown Event 2213, not 4012 Look for 2213

Prove the cause before changing anything

Every check here only reads.

  1. In Event Viewer, open the DFS Replication log. Find event 4012 and note the time, folder path and replication group name. Check whether other members logged it.
  2. Read the limit. Microsoft's page gives this command:
wmic.exe /node:%computername% /namespace:\\root\microsoftdfs path DfsrMachineConfig get MaxOfflineTimeInDays

60 means content freshness is on at its default. 0 means it is off, so 4012 is not coming from this setting on this server.

  1. Read the SYSVOL state on every domain controller. Microsoft's page gives this loop for a command prompt:
For /f %i IN ('dsquery server -o rdn') do @echo %i && @wmic /node:"%i" /namespace:\\root\microsoftdfs path dfsrreplicatedfolderinfo WHERE replicatedfoldername='SYSVOL share' get replicationgroupname,replicatedfoldername,state

State 4 is Normal and 5 is In Error. A domain controller in poor condition may report no instances.

  1. Check every member's log for 2213, 4614 and 4604, as in the table.
  2. Measure how far behind the stale server is:
Get-DfsrBacklog -GroupName "<group>" -FolderName "<folder>" -SourceComputerName "<healthy server>" -DestinationComputerName "<stale server>" -Verbose

The documentation says it lists at most 100 files, that -Verbose shows the full count, and that a backlog indicates latency, not necessarily a problem. Its examples do not show a stopped member, so treat the number as an indication only.

4012 on one or two members with a healthy partner means a stale member to recover non-authoritatively. 4012 on every domain controller with state 5 means there is no healthy source, so you must choose one authoritative server. 2213 without 4012 is a different fix.

Fix

Take a backup first. Microsoft's SYSVOL page says to back up SYSVOL on each affected domain controller, by file copy or backup software, and to back up PreExisting and Conflict and Deleted too, because their contents are purged if initial synchronisation is done multiple times.

SYSVOL on a domain controller: the KB 2218556 steps

KB 2218556 says: "You can't use the DFS Management snap-in (Dfsmgmt.msc) or the Dfsradmin.exe command-line tool to achieve this." It explains that SYSVOL replication is "intentionally protected from any editing through its management interfaces to prevent accidents". Use ADSI Edit (ADSIEDIT.MSC) as below, not those tools and not Set-DfsrMembership.

The SYSVOL page says to know the replication topology and fan out from a healthy domain controller: its direct partners first, then those downstream.

Non-authoritative recovery (stale controllers, healthy partners)

KB 2218556 says that when repairing only one domain controller, you make it non-authoritative and leave the others alone. Do this on each domain controller to be made non-authoritative.

  1. In ADSIEDIT.MSC, set this on the distinguished name shown:
CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings,CN=<the server name>,OU=Domain Controllers,DC=<domain>

msDFSR-Enabled=FALSE

Disruptive step: stops SYSVOL replication on that controller. Back-out: set it back to TRUE, then force replication and run DFSRDIAG POLLAD as below. That back-out is not free: setting TRUE starts the initial synchronisation itself, with the data-loss risk marked at step 5.

  1. Force Active Directory replication throughout the domain (the KB gives no command). Risk: pushes the change to every controller now; back-out: set msDFSR-Enabled=TRUE again and force replication.
  2. On the same servers, from an elevated command prompt, run DFSRDIAG POLLAD. Risk: makes DFSR act on the change now; back-out: set msDFSR-Enabled=TRUE again, force replication and poll.
  3. Wait for Event ID 4114 in the DFS Replication log, which the KB says shows SYSVOL is no longer being replicated. The SYSVOL page prints 4144 in one step; the KB prints 4114.
  4. On the same DN, set msDFSR-Enabled=TRUE. Disruptive step: starts initial synchronisation; data not matching partners goes to PreExisting or Conflict and Deleted and some can be lost. There is no way back except your backup.
  5. Force Active Directory replication throughout the domain again. Risk: pushes the re-enable everywhere; no back-out once synchronising except your backup.
  6. Run DFSRDIAG POLLAD on the same servers. Risk: starts synchronisation now; no back-out except your backup.
  7. Wait for Event IDs 4614 and 4604, which the KB says mean SYSVOL replication has been initialised. Restore needed files from backup or PreExisting and Conflict and Deleted.

Authoritative recovery (every domain controller logged 4012, state 5)

The SYSVOL page calls this the only situation to set a server authoritative, and says the chosen controller must hold the most up-to-date copy of all SYSVOL contents. The KB prefers the PDC Emulator, and says that if you set one controller authoritative you must non-authoritatively synchronise all the others, or conflicts result.

  1. Set the DFS Replication service Startup Type to Manual and stop it on all domain controllers. Disruptive step: no SYSVOL replication runs until the service is started again in steps 5 and 11; back-out: start it and restore Automatic.
  2. In ADSIEDIT.MSC on the chosen controller, at the same DN as above, set both:
msDFSR-Enabled=FALSE
msDFSR-options=1

Disruptive step: marks this copy as the one every other controller takes. If it is the wrong server, newer files elsewhere are overwritten; the only way back is an earlier backup.

  1. On all other controllers, at CN=SYSVOL Subscription,CN=Domain System Volume,CN=DFSR-LocalSettings,CN=<each other server name>,OU=Domain Controllers,DC=<domain>, set msDFSR-Enabled=FALSE. Disruptive step: stops their SYSVOL replication; back-out before step 12 is setting TRUE, after it your backup.
  2. Force Active Directory replication throughout the domain and validate it on all controllers. Risk: pushes steps 2 and 3 everywhere; back-out is reversing the attributes.
  3. Start the DFS Replication service on the authoritative controller only. Risk: it starts with the settings above; back-out: stop it.
  4. Wait for Event ID 4114 on it.
  5. At the step 2 DN, set msDFSR-Enabled=TRUE. Disruptive step: initialises SYSVOL there as the primary copy; no back-out once others take it except your backup.
  6. Force Active Directory replication and validate on all controllers. Risk: pushes the re-enable everywhere; no back-out once others take the copy, except your backup.
  7. On the authoritative controller, run DFSRDIAG POLLAD. Risk: makes it initialise SYSVOL now; no back-out except your backup.
  8. Wait for Event ID 4602, which the KB says shows SYSVOL has been initialised there.
  9. Start the DFS Replication service on the other controllers and wait for 4114 on each. Risk: they start with SYSVOL disabled; back-out: stop the service.
  10. On all other controllers at their DNs, set msDFSR-Enabled=TRUE. Disruptive step: each takes the authoritative copy; data it holds that the copy lacks goes to PreExisting or Conflict and Deleted, and some can be lost. There is no way back except your backup.
  11. On all non-authoritative controllers run DFSRDIAG POLLAD. Risk: starts their synchronisation now; no back-out except your backup.
  12. Return the service to Automatic on all controllers. Risk: the service starts on its own at boot again; back-out: set Manual and stop it.

A custom (non-SYSVOL) replicated folder

KB 2218556 says SYSVOL, unlike custom DFSR replicated folders, is protected from editing through management tools. For a custom folder, the Set-DfsrMembership page says -DisableMembership stops replication on that computer without deleting the folder or its private replication data, and that re-enabling loses private data, can lose replicated data, and may be recoverable with Restore-DfsrPreservedFiles. No page cited here describes this as a 4012 procedure, so treat it as the cmdlet's documented behaviour only.

Set-DfsrMembership -GroupName "<group>" -FolderName "<folder>" -ComputerName "<stale server>" -DisableMembership $true

Disruptive step: stops replication of that folder on that server. Back-out: the re-enable below, which carries its own data loss.

Set-DfsrMembership -GroupName "<group>" -FolderName "<folder>" -ComputerName "<stale server>" -DisableMembership $false

Disruptive step: the page says private data is lost and replicated data can be lost. There is no way back except your backup and Restore-DfsrPreservedFiles.

Do not raise the limit as a shortcut. Microsoft's page documents recovery, not raising MaxOfflineTimeInDays. Do not delete the DFSR database. The SYSVOL page says it should not be required, is discouraged, and makes DFSR treat all local data as non-authoritative.

Confirm the fix

  • Events 4614 and 4604 are logged on each recovered controller (4602 on the authoritative one).
  • The state query shows 4 for SYSVOL on every controller, and the SYSVOL and Netlogon shares are present (net view \\<server>).
  • Get-DfsrBacklog from a healthy partner counts down towards zero when repeated.
  • No new 4012 appears and your backed-up files are restored where needed.

Example (illustrative): dc01, dc02 and dc03 replicate SYSVOL for CONTOSO. dc02 is switched off in a branch cupboard for 75 days, which is 15 days beyond the 60-day limit. On power-up, dc02 logs 4012 and the state query reports 5, while dc01 and dc03 report 4. The administrator copies dc02's SYSVOL and PreExisting folders to fs01, sets msDFSR-Enabled=FALSE on dc02's SYSVOL Subscription object only, forces Active Directory replication, runs DFSRDIAG POLLAD and waits for 4114. Then TRUE, forced replication, another poll, and 4614 and 4604. The state query then reports 4 on all three.

What to watch afterwards

  • Record MaxOfflineTimeInDays on each server (60 or 0). A server allowed offline for months needs a plan before it is switched off.
  • Query SYSVOL state on every controller on a schedule; Microsoft recommends regular checks of event logs, health reports and replication state.
  • Watch for ESENT recovery events and disk problems; Microsoft says they coincide with unexpected shutdowns that stop DFSR closing cleanly.

Risks and limits

These commands have not been run or lab-tested. The ADSI Edit steps follow KB 2218556 as written on Microsoft Learn, whose companion page says reinitialising is unnecessary in most cases and may cause data loss if done incorrectly. The KB is written for a two-controller environment (with more, expand the steps to all of them) and assumes you can restore deleted or damaged data. An authoritative choice overwrites the other members, and neither route can be undone without a backup.

Sources