6

Is there a way to monitor the DFSR backlog in a manner more efficient than using dfsrdiag.exe backlog?

I wrote a program that just slurps in the backlog count via dfsrdiag.exe backlog /smem:alpha /rmem:beta /rgname:domain\namespace\foldername /rfname:foldername with five minute intervals. Each time it runs, it takes quite a while (between 2 to 5 minutes) to get the resulting value. That means that in the end, it runs for a few minutes to collect the info and then delays for five minutes. It feels like it is probably expensive in some fashion in order to get this info. It also returns the top 100 files in the backlog. I really only want the backlog count alone and don't care about the files themselves. This is being used to create historical graphs.

Info for these DFSR peers: Windows 2008 R2 on four servers, three distant offices connected via 50-100Mb Internet connections, 30 replication groups, several replication groups are very large in file total size (1-2TB each) though most are small (500MB-10GB).

Emmaly
  • 425
  • 2
  • 8
  • 16
  • Are you seeing a significant increase in resource utilization while your program collects data? You seem to be asking for a fix to something you aren't sure is broke. – HostBits May 23 '12 at 02:14
  • I reworded the question. I want to know if there is a way to do it more efficient than using dfsrdiag itself. – Emmaly May 23 '12 at 03:10

2 Answers2

10

There is another way to get at the information, and that's through WMI. An enterprising soul has put together a PowerShell script that gathers this information:

http://gallery.technet.microsoft.com/scriptcenter/dac62790-219d-4325-a57b-e79c2aa6b58e

No indication of whether or not is faster than dfsrdiag, but I suspect it just might be.

The WMI root is root\MicrosoftDFS and from there you can do the queries via Get-WmiObject

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
  • This answer was very useful and it looks like it'll get me exactly what I want. The important part is that local access is pretty much instantaneous. To actually get the resulting backlog value, it looks like you need values from both servers. For my need, I would fetch those values from multiple servers many times and can do the calculations in my code instead of needing `dfsrdiag` to fetch the same values over and over again for each pairing combination. That should save tons of processing time alone. Plus the peers can communicate their values via an external communication channel I choose. – Emmaly May 23 '12 at 08:56
0

Here's a pure PowerShell way to do it:

$RegEx=[System.Text.RegularExpressions.Regex]::new("Count: (\d+)$")
$DFSObjects=@()
$DFSRMembers=Get-DfsrMembership | Where-Object { $_.Enabled } | Where-Object { $_.GroupName -eq "<namespace>" }
$DFSRMembers=@($DFSRMembers)
if ($DFSRMembers.Count -gt 1) {
  for ($i=0; $i -lt $DFSRMembers.Count; $i++) {
    $OtherMembers=$DFSRMembers | Where-Object { ($_.ComputerName -ne $DFSRMembers[$i].ComputerName) -and ($_.FolderName -eq $DFSRMembers[$i].FolderName) }
    $OtherMembers=@($OtherMembers)
    if ($OtherMembers.Count -ne 0) {
      for ($j=0; $j -lt $OtherMembers.Count; $j++) {
        $BackLog=($($Junk=.{Get-DfsrBacklog -GroupName $DFSRMembers[$i].GroupName -FolderName $DFSRMembers[$i].FolderName -SourceComputerName $DFSRMembers[$i].ComputerName -DestinationComputerName $OtherMembers[$j].ComputerName -Verbose}) 4>&1).Message
        $Matches=$RegEx.Matches($BackLog)
        if ($Matches -ne $null) { $BackLog=[System.Convert]::ToInt32($RegEx.Matches($backlog).Groups[1].Value) } else { $BackLog=0 }
        $DFSObject=New-Object -Type PSObject -Property @{Group=$DFSRMembers[$i].GroupName;Folder=$DFSRMembers[$i].FolderName;From=$DFSRMembers[$i].ComputerName;To=$OtherMembers[$j].ComputerName;Backlog=$BackLog}
        $DFSObjects+=$DFSObject
      }
    }
  }
}
$DFSObjects | Sort-Object -Property BackLog -Descending | Format-Table -Property Group,Folder,From,To,Backlog
  • Slogmeister, What version of PS are you using? I'm getting a few errors with the code. Thanks – John T Jan 29 '21 at 23:24
  • @JohnT PowerShell 5.1 on Windows 10 (20H2) in the same domain as the DFS server. I corrected the script above as I had hardcoded a namespace. – Slogmeister Extraordinaire Feb 01 '21 at 14:59
  • This answer relies upon PowerShell cmdlets introduced in Server 2012r2 and will not work if any DFSR members are 2012 or earlier. – Thomas Jul 12 '22 at 17:30