---
title: "Find Stuck DFS Replication Backlogs with PowerShell"
description: "Find out whether DFS Replication is caught up. Get-DfsrBacklog reads the full file count past the 100-file limit, then a loop checks every group."
canonical: "https://adamtheautomator.com/dfs-replication-backlog-powershell/"
---

# Find Stuck DFS Replication Backlogs with PowerShell

> Find out whether DFS Replication is caught up. Get-DfsrBacklog reads the full file count past the 100-file limit, then a loop checks every group.

Source: https://adamtheautomator.com/dfs-replication-backlog-powershell/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Find Stuck DFS Replication Backlogs with PowerShell](https://adamtheautomator.com/wp-content/uploads/publisher/3f95d9c85b2b8181be1be294c37c6724/0ba6a36aaba4a30390fca48d395a19d38846d030302d345372b68b077c3a5cdc.jpg)

# Find Stuck DFS Replication Backlogs with PowerShell

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)20 October 20263 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)[DFS](/tag/dfs/)[File Management](/tag/file-management/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Check One Server Pair with Get-DfsrBacklog](#check-one-server-pair-with-get-dfsrbacklog)
*   [Get the Full Count from the Verbose Stream](#get-the-full-count-from-the-verbose-stream)
*   [Check Every Group, Folder, and Direction](#check-every-group-folder-and-direction)
*   [Discover Every Pair to Check](#discover-every-pair-to-check)
*   [Handle Unreachable Members](#handle-unreachable-members)
*   [List the Pairs That Are Behind](#list-the-pairs-that-are-behind)
*   [Decide Whether the Number Matters](#decide-whether-the-number-matters)
*   [Compare Two Runs](#compare-two-runs)

Both servers report Running, yet a ticket says the file saved at headquarters never reached the branch office. Which server is wrong? Neither one. A service can run all day while the queue of files [DFS Replication](https://learn.microsoft.com/en-us/windows-server/storage/dfs-replication/dfs-replication-overview) owes its partner keeps growing.

So how many files is headquarters still holding for the branch, and is that number shrinking? [`Get-DfsrBacklog`](https://learn.microsoft.com/en-us/powershell/module/dfsr/get-dfsrbacklog?view=windowsserver2025-ps) answers for one pair of servers, and a short loop asks every pair in the domain.

## Prerequisites

If you want to follow along, you need:

*   The DFSR PowerShell module for [DFS Replication](https://adamtheautomator.com/dfs-replication/). On a server with the Desktop Experience, `Install-WindowsFeature RSAT-DFS-Mgmt-Con` adds it.
    
*   Windows Server 2016 through 2025. Microsoft publishes the [DFSR cmdlet reference](https://learn.microsoft.com/en-us/powershell/module/dfsr/?view=windowsserver2025-ps) for those four releases.
    

[Microsoft’s install guide](https://learn.microsoft.com/en-us/windows-server/storage/dfs-replication/install-dfs-replication) says the DFS Management Tools install “the DFS Replication and DFS Namespaces modules for Windows PowerShell.” Skip the install if `Get-Module -ListAvailable DFSR` already lists the module.

## Check One Server Pair with Get-DfsrBacklog

`Get-DfsrBacklog` asks a sending server what it still owes a receiving server for one replicated folder (a folder DFS Replication copies between the servers in a group). Here SRV01 (headquarters) sends and SRV02 (the branch) receives, in replication group Branch-Files, folder RF01:

```powershell
Get-DfsrBacklog -GroupName 'Branch-Files' -FolderName 'RF01' `
    -SourceComputerName 'SRV01' -DestinationComputerName 'SRV02'
```

`-SourceComputerName` is the sending (upstream) member and `-DestinationComputerName` is the receiving (downstream) member. [Microsoft’s reference](https://learn.microsoft.com/en-us/powershell/module/dfsr/get-dfsrbacklog?view=windowsserver2025-ps) marks both as mandatory. Swapping them queries the opposite direction.

`Get-DfsrBacklog` returns one record per pending file or folder. In Microsoft’s words, “The maximum number of files that this command displays is 100.”

### Get the Full Count from the Verbose Stream

The `Get-DfsrBacklog` reference says the `-Verbose` parameter displays a count of all backlogged updates. Verbose messages travel on stream 4 in PowerShell, so redirect them into the success stream with `4>&1` (see [about\_Redirection](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection)) and keep only the message:

```powershell
Get-DfsrBacklog -GroupName 'Branch-Files' -FolderName 'RF01' `
    -SourceComputerName 'SRV01' -DestinationComputerName 'SRV02' -Verbose 4>&1 |
    Where-Object { $_ -is [System.Management.Automation.VerboseRecord] } |
    ForEach-Object Message
```

The redirected stream now carries the file records and the message together, so the `Where-Object` filter keeps only the `VerboseRecord`. The documented text, with the count at the end, looks like this:

```text
The replicated folder has a backlog of files. Replicated folder: "RF01". Count: 2400
```

That 2400 counts every update SRV01 still owes SRV02, and it’s the number you’ll collect for every pair next.

## Check Every Group, Folder, and Direction

Replication connections are one-way, so a two-member group has two connections, and a backlog in either direction means that group is behind. The diagram below shows the two directions you have to check.

![Both backlog directions](https://adamtheautomator.com/wp-content/uploads/publisher/6a85d5ac6b1ce75c5fd501dc6828bced9085ec713435807bd59f2d04a3fae60b.jpg)

### Discover Every Pair to Check

Three cmdlets supply everything `Get-DfsrBacklog` needs:

| Cmdlet | Supplies |
| --- | --- |
| [Get-DfsReplicationGroup](https://learn.microsoft.com/en-us/powershell/module/dfsr/get-dfsreplicationgroup?view=windowsserver2025-ps) | `GroupName` for each group |
| [Get-DfsReplicatedFolder](https://learn.microsoft.com/en-us/powershell/module/dfsr/get-dfsreplicatedfolder?view=windowsserver2025-ps) | `FolderName` for each folder in a group |
| [Get-DfsrConnection](https://learn.microsoft.com/en-us/powershell/module/dfsr/get-dfsrconnection?view=windowsserver2025-ps) | `SourceComputerName` and `DestinationComputerName` for each one-way connection |

`Get-DfsReplicationGroup` skips the Domain System Volume (SYSVOL) group unless you add `-IncludeSysvol`.

The loop fetches folders and connections once per group, then crosses them:

```powershell
$results = foreach ($group in Get-DfsReplicationGroup) {
    $folders = Get-DfsReplicatedFolder -GroupName $group.GroupName
    foreach ($conn in Get-DfsrConnection -GroupName $group.GroupName) {
        foreach ($folder in $folders) {
            try {
                $output = Get-DfsrBacklog -GroupName $group.GroupName `
                    -FolderName $folder.FolderName `
                    -SourceComputerName $conn.SourceComputerName `
                    -DestinationComputerName $conn.DestinationComputerName `
                    -Verbose -ErrorAction Stop 4>&1
            }
            catch {
                Write-Warning "$($conn.SourceComputerName) to $($conn.DestinationComputerName): $_"
                continue
            }
            $message = ($output | Where-Object { $_ -is [System.Management.Automation.VerboseRecord] }).Message
            [pscustomobject]@{
                Group   = $group.GroupName
                Folder  = $folder.FolderName
                From    = $conn.SourceComputerName
                To      = $conn.DestinationComputerName
                Backlog = [int][regex]::Match($message, 'Count: (\d+)').Groups[1].Value
            }
        }
    }
}
```

The innermost call is the single-pair command from earlier, now fed by the discovered names. The regex `Count: (\d+)` captures the digits, and `[int]` casts them so `Sort-Object` compares numbers instead of strings.

* * *

_**Key Insight: The ticket’s file was saved at headquarters, so look for it in the SRV01 to SRV02 row; a zero from SRV02 to SRV01 says nothing about it.**_

* * *

### Handle Unreachable Members

The `try` block uses `-ErrorAction Stop` so an unreachable member produces a warning and the loop moves on. Without it, a failed query can leave the row reading zero backlog for a member you never reached.

* * *

_**Warning: Microsoft doesn’t document what the cmdlet prints when nothing is queued. In this script, a pair with no message and no warning reports 0. Run the single-pair command by hand against one quiet pair before you trust a column of zeros.**_

* * *

### List the Pairs That Are Behind

Now ask the table for what needs attention:

```powershell
$results | Where-Object Backlog -gt 0 | Sort-Object Backlog -Descending | Format-Table -AutoSize
```

The example below shows the result, largest backlog first.

![Sorted backlog results](https://adamtheautomator.com/wp-content/uploads/publisher/73b4118575e92a2f71dcbc67cd8815d9cb91d44cbff16c4139bbfb5626fdf018.jpg)

## Decide Whether the Number Matters

The [Get-DfsrBacklog documentation](https://learn.microsoft.com/en-us/powershell/module/dfsr/get-dfsrbacklog?view=windowsserver2025-ps) puts it plainly: “A backlog indicates latency, and a backlog may be expected in your environment, depending on configuration, rate of change, network, and other factors.”

New files arriving in bulk spike a server’s count, which then drains on its own, so one reading can’t separate a spike from a stall.

### Compare Two Runs

Read the trend:

1.  Run the script and keep the table.
    
2.  Run it again 10 to 15 minutes later.
    
3.  Compare each row. Falling counts mean replication is catching up. Investigate first any pair whose count holds steady or rises, because that pair is stuck.
    

Send any row that stays high to whoever owns those servers. Trust all zeros only after your hand check of a quiet pair.

Then check whether an application at headquarters still holds the file locked, since [Microsoft’s DFS Replication FAQ](https://learn.microsoft.com/en-us/windows-server/storage/dfs-replication/dfsr-faq) says a file an application holds locked isn’t replicated until it’s closed.

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fdfs-replication-backlog-powershell%2F&text=Find%20Stuck%20DFS%20Replication%20Backlogs%20with%20PowerShell)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fdfs-replication-backlog-powershell%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fdfs-replication-backlog-powershell%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2021/08/Icacls-The-Ultimate-Guide.jpg)

### [Icacls: The Ultimate Guide in Managing File Permissions](/icacls/)

Learn how to grant, deny, remove permissions, and more with the icacls command in this ultimate guide!

![](https://adamtheautomator.com/wp-content/uploads/2019/07/dfs-overview.png)

### [Efficient DFS Management with PowerShell Scripts](/dfs-powershell-scripts/)

Automate and manage every aspect of DFS using comprehensive PowerShell scripts.

![](https://adamtheautomator.com/wp-content/uploads/2019/07/5d238ae5c824b514689ea65f.jpg)

### [Automate File Transfers with PowerShell & Scheduled Tasks](/automated-file-transfer/)

Set up automated file transfers using PowerShell and create scheduled tasks to run your script on a recurring basis.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
