# Windows - How To Fix DFS Replication Event 4012 on Domain Controller

### 1. Verifying Server Promotion Status

The first crucial step in resolving DFS replication Event ID 4012 is to verify the server’s promotion status. Any discrepancies in the promotion process can lead to issues with DFSR. Administrators can use tools like Active Directory Users and Computers (ADUC) or PowerShell commands to ensure that the server has been successfully promoted to a domain controller.

### 2. Adjusting MaxOfflineTimeInDays

An easy fix for Event ID 4012 involves adjusting the **MaxOfflineTimeInDays** parameter. This parameter determines the maximum duration a server can remain offline before triggering the error. If the server was offline for an extended period, increasing this threshold can resolve the issue.

#### Using WMIC Commands for MaxOfflineTimeInDays

To check the current MaxOfflineTimeInDays value, administrators can use the following command:

```shell
wmic.exe /namespace:\\root\microsoftdfs path dfsrMachineConfig get MaxOfflineTimeinDays
```

To increase the MaxOfflineTimeInDays value, use the following command, setting it to a value higher than the time the server was offline:

```shell
wmic.exe /namespace:\\root\microsoftdfs path dfsrMachineConfig set MaxOfflineTimeinDays=100
```

These commands provide a quick and efficient way to address the time constraint set by MaxOfflineTimeInDays, ensuring that the DFS Replication service can resume without encountering the 4012 error.

### 3. Initiating DFS Replication Partnerships

Starting DFS Replication Partnerships involves establishing connections to enable the synchronized replication of data between servers. One method to achieve this is by manually running DFS replication using the <span class="code" spellcheck="false">repadmin /syncall /AeD</span> command or initiate it through the Active Directory Sites and Services console.

The [repadmin cmd](https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc770963(v=ws.11)) provides a direct and efficient way to trigger synchronization across all domain controllers, aiding in the resolution of replication interruptions and maintaining consistent data distribution.

### 4. Set MaxOfflineTimeInDays Back to Default 60 Days

Once the replication is complete set MaxOfflineTimeInDays value back to default 60 Days

```shell
wmic.exe /namespace:\\root\microsoftdfs path dfsrMachineConfig set MaxOfflineTimeinDays=60
```