How to Set Up DFS Replication for File Server Redundancy on Windows Server 2025

DFS Replication (DFSR) is a high-performance, multi-master replication engine built into Windows Server 2025 that keeps folders synchronized across multiple servers automatically. Unlike a simple file copy, DFSR uses the Remote Differential Compression (RDC) algorithm to transmit only the changed blocks of a file rather than the entire file, making it efficient even over limited-bandwidth WAN links. When combined with a DFS Namespace, replicated shares appear as a single logical path to end users—so if one server becomes unavailable, the DFS client automatically redirects to the surviving replica. This tutorial walks through the complete DFSR setup from role installation through namespace integration and ongoing health monitoring.

Prerequisites

  • At least two Windows Server 2025 servers (Standard or Datacenter) joined to the same Active Directory domain
  • The servers named in this guide are FS01 and FS02
  • A shared folder already exists or will be created on each server (e.g., E:SharesCompanyData)
  • Domain Admin or delegated DFSR Admin rights
  • Network connectivity between replication partners (ports TCP/UDP 135, TCP 5722 for DFSR)
  • Sufficient free disk space on each member: at least 110% of the data being replicated to accommodate the staging folder and ConflictAndDeleted cache
  • PowerShell RSAT tools: RSAT-DFS-Mgmt-Con

Step 1: Install the DFS Replication Role on Both Servers

Install the DFS Replication role feature on every server that will participate in replication. Run this on both FS01 and FS02, or use Invoke-Command to target multiple servers simultaneously.

# Install on both servers simultaneously
$servers = @("FS01", "FS02")

Invoke-Command -ComputerName $servers -ScriptBlock {
    Install-WindowsFeature `
        -Name                  FS-DFS-Replication `
        -IncludeManagementTools `
        -Restart:$false

    # Also install Namespace if you will use DFS-N with replication
    Install-WindowsFeature `
        -Name                  FS-DFS-Namespace `
        -IncludeManagementTools `
        -Restart:$false

    Get-WindowsFeature FS-DFS-Replication, FS-DFS-Namespace |
        Select-Object Name, InstallState
}

# Install DFSR management tools on the admin workstation
Install-WindowsFeature -Name RSAT-DFS-Mgmt-Con

# Ensure the DFSR service is running and set to automatic on both servers
Invoke-Command -ComputerName $servers -ScriptBlock {
    Set-Service -Name DFSR -StartupType Automatic
    Start-Service -Name DFSR
    Get-Service DFSR | Select-Object Name, Status, StartType
}

Step 2: Create the Replication Group

A Replication Group is the top-level DFSR container that defines which servers participate in replication. Members, connections, and replicated folders are all configured within the group.

Import-Module DFSR

$rgName = "CompanyData-RG"
$domain = "contoso.local"

# Create the replication group in Active Directory
New-DfsReplicationGroup `
    -GroupName   $rgName `
    -DomainName  $domain `
    -Description "Replication group for CompanyData share between FS01 and FS02"

# Verify
Get-DfsReplicationGroup -GroupName $rgName | Format-List *

Step 3: Add Members to the Replication Group

Members are the servers that participate in the replication group. Add both file servers as members.

$rgName = "CompanyData-RG"
$domain = "contoso.local"

# Add FS01 as a member
Add-DfsrMember `
    -GroupName   $rgName `
    -DomainName  $domain `
    -ComputerName "FS01"

# Add FS02 as a member
Add-DfsrMember `
    -GroupName   $rgName `
    -DomainName  $domain `
    -ComputerName "FS02"

# List members
Get-DfsrMember -GroupName $rgName -DomainName $domain |
    Select-Object GroupName, ComputerName, DomainName, State

Step 4: Configure Replication Connections

Connections define the replication partnerships between members. For two-way replication, create one connection in each direction. DFSR will use whichever direction is most efficient, but both must exist for full bi-directional sync.

$rgName = "CompanyData-RG"
$domain = "contoso.local"

# Create connection from FS01 to FS02
Add-DfsrConnection `
    -GroupName            $rgName `
    -DomainName           $domain `
    -SourceComputerName   "FS01" `
    -DestinationComputerName "FS02" `
    -Description          "FS01 to FS02 two-way link"

# Create the reverse connection from FS02 to FS01
Add-DfsrConnection `
    -GroupName            $rgName `
    -DomainName           $domain `
    -SourceComputerName   "FS02" `
    -DestinationComputerName "FS01" `
    -Description          "FS02 to FS01 two-way link"

# Verify connections
Get-DfsrConnection -GroupName $rgName -DomainName $domain |
    Select-Object GroupName, SourceComputerName, DestinationComputerName, Enabled, State

# Optional: Schedule replication only during off-peak hours (11 PM – 6 AM)
# Get the current bandwidth schedule
$schedule = Get-DfsrConnectionSchedule `
    -GroupName               $rgName `
    -DomainName              $domain `
    -SourceComputerName      "FS01" `
    -DestinationComputerName "FS02"

# Apply a bandwidth-throttled schedule during business hours
Set-DfsrConnectionSchedule `
    -GroupName               $rgName `
    -DomainName              $domain `
    -SourceComputerName      "FS01" `
    -DestinationComputerName "FS02" `
    -UseDefaultSchedule

Step 5: Add and Configure Replicated Folders

A Replicated Folder is the directory that DFSR keeps synchronized across all members. You must specify the local path on each member server and designate one server as the primary member—this is the authoritative source for the initial sync.

$rgName  = "CompanyData-RG"
$domain  = "contoso.local"
$rfName  = "CompanyData"

# Create the replicated folder definition in the replication group
New-DfsReplicatedFolder `
    -GroupName    $rgName `
    -DomainName   $domain `
    -FolderName   $rfName `
    -Description  "Main company file share — replicated between FS01 and FS02"

# Create the physical directories on both servers (if not already present)
Invoke-Command -ComputerName "FS01" -ScriptBlock {
    New-Item -ItemType Directory -Path "E:SharesCompanyData" -Force | Out-Null
}
Invoke-Command -ComputerName "FS02" -ScriptBlock {
    New-Item -ItemType Directory -Path "E:SharesCompanyData" -Force | Out-Null
}

# Set FS01 as the primary member (initial data source)
# Primary member designation is only relevant during initial sync
Set-DfsrMembership `
    -GroupName    $rgName `
    -DomainName   $domain `
    -FolderName   $rfName `
    -ComputerName "FS01" `
    -ContentPath  "E:SharesCompanyData" `
    -PrimaryMember $true `
    -StagingPath  "E:DFSRStagingCompanyData" `
    -StagingPathQuotaInMB 4096 `
    -Enabled $true

# Configure FS02 as a non-primary member
Set-DfsrMembership `
    -GroupName    $rgName `
    -DomainName   $domain `
    -FolderName   $rfName `
    -ComputerName "FS02" `
    -ContentPath  "E:SharesCompanyData" `
    -PrimaryMember $false `
    -StagingPath  "E:DFSRStagingCompanyData" `
    -StagingPathQuotaInMB 4096 `
    -Enabled $true

# Force a poll of the AD configuration on both members
Invoke-Command -ComputerName "FS01", "FS02" -ScriptBlock {
    Update-DfsrConfigurationFromAD -ComputerName $env:COMPUTERNAME
}

Write-Host "DFSR membership configured. Initial replication will begin shortly."
Write-Host "FS01 is the primary member — its data will be authoritative for the first sync."

Step 6: Monitor Replication Health

After configuration, monitor DFSR to confirm replication is healthy and measure backlog (files queued but not yet replicated).

$rgName = "CompanyData-RG"
$domain = "contoso.local"

# Check the overall replication group membership state
Get-DfsrReplicationGroupMembership `
    -GroupName  $rgName `
    -DomainName $domain |
    Select-Object GroupName, ComputerName, FolderName, State, ContentPath, StagingPath

# Get the current replication state from FS01's perspective
Get-DfsrState `
    -ComputerName "FS01" `
    -Verbose |
    Select-Object GroupName, FolderName, State, BacklogCount, ReplicationPartner

# Check the backlog (files waiting to replicate from FS01 to FS02)
Get-DfsrBacklog `
    -SourceComputerName      "FS01" `
    -DestinationComputerName "FS02" `
    -GroupName               $rgName `
    -FolderName              "CompanyData" |
    Measure-Object | Select-Object Count

# Detailed backlog listing (first 20 files)
Get-DfsrBacklog `
    -SourceComputerName      "FS01" `
    -DestinationComputerName "FS02" `
    -GroupName               $rgName `
    -FolderName              "CompanyData" |
    Select-Object -First 20 FileName, UpdateTime

# Run dfsrdiag for a diagnostic report
dfsrdiag ReplicationState /rgname:"CompanyData-RG" /rfname:"CompanyData"
dfsrdiag PollAD /member:FS01
dfsrdiag StaticRTT /partner:FS02 /rgname:"CompanyData-RG"

# Check DFSR event log for errors
Get-WinEvent -ComputerName "FS01" -LogName "DFS Replication" -MaxEvents 20 |
    Where-Object { $_.LevelDisplayName -in "Error","Warning" } |
    Select-Object TimeCreated, Id, Message |
    Format-List

Step 7: Add a DFS Namespace with Replication for Transparent Failover

A DFS Namespace makes the replicated folder accessible as a single, location-independent UNC path. If FS01 goes offline, DFS clients automatically connect to FS02 without manual intervention.

$domain    = "contoso.local"
$namespace = "\contoso.localShares"
$rfName    = "CompanyData"

# Create a domain-based namespace root
New-DfsnRoot `
    -TargetPath   "\FS01DFSRootsShares" `
    -Path         $namespace `
    -Type         "DomainV2" `
    -Description  "Domain DFS Namespace for company file shares"

# Create the physical namespace root folder on FS01
Invoke-Command -ComputerName "FS01" -ScriptBlock {
    New-Item -ItemType Directory -Path "C:DFSRootsShares" -Force | Out-Null
    New-SmbShare -Name DFSRoots -Path C:DFSRoots -FullAccess "Domain Admins" | Out-Null
}

# Add FS02 as a second namespace root (for namespace redundancy)
New-DfsnRootTarget `
    -Path       $namespace `
    -TargetPath "\FS02DFSRootsShares"

# Create a DFS folder link pointing to the replicated share on FS01 and FS02
New-DfsnFolder `
    -Path        "$namespace$rfName" `
    -TargetPath  "\FS01CompanyData" `
    -Description "CompanyData replicated share — primary target FS01"

New-DfsnFolderTarget `
    -Path       "$namespace$rfName" `
    -TargetPath "\FS02CompanyData"

# Configure target priority (FS01 preferred, FS02 failover)
Set-DfsnFolderTarget `
    -Path             "$namespace$rfName" `
    -TargetPath       "\FS01CompanyData" `
    -ReferralPriorityClass "sitecos-t-1"  # Site-cost target, first choice

Set-DfsnFolderTarget `
    -Path             "$namespace$rfName" `
    -TargetPath       "\FS02CompanyData" `
    -ReferralPriorityClass "sitecos-t-2"  # Site-cost target, second choice

# Test the namespace resolution
Get-DfsnFolderTarget -Path "$namespace$rfName" |
    Select-Object Path, TargetPath, State, ReferralPriorityClass

Step 8: Understanding Conflict Resolution (ConflictAndDeleted Folder)

When two users modify the same file on different replicas before synchronization occurs, DFSR must resolve the conflict. The losing version is moved to the hidden DfsrPrivateConflictAndDeleted folder rather than deleted outright.

# View files in the ConflictAndDeleted folder on FS02
$conflictPath = "E:SharesCompanyDataDfsrPrivateConflictAndDeleted"

if (Test-Path $conflictPath) {
    $conflicts = Get-ChildItem $conflictPath -Force
    Write-Host "Conflicted files found: $($conflicts.Count)"
    $conflicts | Select-Object Name, LastWriteTime, Length | Format-Table

    # Read the ConflictAndDeletedManifest.xml for metadata about each conflict
    $manifestPath = "E:SharesCompanyDataDfsrPrivateConflictAndDeletedManifest.xml"
    if (Test-Path $manifestPath) {
        [xml]$manifest = Get-Content $manifestPath
        $manifest.Objs.Obj |
            Select-Object @{n="OriginalName";e={($_.Props.S | Where-Object N -eq "OriginalName").'#text'}},
                          @{n="ConflictedAt";e={($_.Props.DT | Where-Object N -eq "ConflictTime").'#text'}} |
            Format-Table
    }
} else {
    Write-Host "No conflicts found on this replica."
}

# Configure the conflict file size limit (default 660 MB per volume)
Set-DfsrMembership `
    -GroupName               $rgName `
    -DomainName              $domain `
    -FolderName              "CompanyData" `
    -ComputerName            "FS02" `
    -ConflictSizeInMB        1024  # Increase to 1 GB

Conclusion

DFS Replication on Windows Server 2025 provides a robust, bandwidth-efficient solution for keeping file server content synchronized across multiple locations. By installing the DFSR role, creating a replication group with properly configured two-way connections, designating a primary member for the initial sync, and integrating with a DFS Namespace, you give end users a single, stable UNC path that transparently fails over to a replica if the primary server becomes unavailable. The built-in conflict resolution mechanism ensures that simultaneous edits are handled gracefully rather than causing data loss, and the monitoring tools—Get-DfsrState, Get-DfsrBacklog, and dfsrdiag—give you real-time visibility into replication health. Together, these components deliver a high-availability file service without the cost and complexity of shared-disk clustering.