Get-DFSRBacklog PowerShell Script Available
Hi folks. Our buddy Steve Grinker has posted an excellent sample PowerShell script for retrieving DFSR backlogs over the MS Code Gallery site:
Get-DFSRBacklog
https://code.msdn.microsoft.com/GetDFSRBacklog
It uses WMI to retrieve DFSR Replication Groups, Replicated Folders, Connections, and servers, then calculates all of their backlog information. All with a simple command-line and no need to shell DFSRDIAG or WMIC. It’s quite slick.
When you run it with no arguments it returns a human readable output of backlog status on the server you ran the script on, along with all of its partners:
get-dfsrbacklog.ps1
But it also supports more sophisticated options like specifying remote servers, a count of files you consider to be “high backlog” for your specific environment, and some nice output options you get for free thanks to PowerShell pipelines:
get-dfsrbacklog.ps1 <server> <backlog count error threshold> | sort-object backlogstatus | format-table –groupby backlogstatus
Make sure you set bypass execution policies, as the script is unsigned obviously.
This is a great example of why PowerShell often kicks vbscript’s tail. Look at all the code that was required in this vbscript sample, where it is still less flexible than Psh.
Naturally, this script is not supported by Microsoft and we’re just pointing to someone else’s code. If Mr. Grinker wants to chat with you he will. Now maybe someone can convince him to write a PowerShell alternative to restoredfsr.vbs.
Great work Steve!
- Ned “community cheerleader” Pyle
Comments
Anonymous
October 12, 2010
The comment has been removedAnonymous
October 12, 2010
Resolved the issue with the Sending / Receiving naming, and posted "Release 2" of the script. Basically I had the VersionVector logic reversed, as I thought it needed to be for the "sending" rather than "receiving" side.Anonymous
October 13, 2010
Steve, you might want to add the logic for reporting the actual pending changes from my recent post here: blogs.technet.com/.../inspecting-pending-outbound-changes-between-two-dfsr-replicas.aspx ;-) -GuyTeAnonymous
October 13, 2010
@GuyTe Nice script! I definitely like the idea of being able to see the files in the backlog, similar to what you get from DFSRDiag. Although ultimately what we were looking for was a simple summary of current backlog counts for each RG/RF pairing, which is what led to the specific script. Of course I'm starting think that it would be nice to get some of these (along with many others) into a full module... hint... hint... hint... :) Hopefully something "official" will come out along those lines down the road from Microsoft, but until then all of these scripts definitely help!Anonymous
October 21, 2010
Getting an error: PS D:> .Get-DFSRBacklog.ps1 Method invocation failed because [System.Object[]] doesn't contain a method nam ed 'GetVersionVector'. At D:Get-DFSRBacklog.ps1:162 char:82
- $Vv = $InboundPartnerWMI.GetVersionVe ctor <<<< ().VersionVector + CategoryInfo : InvalidOperation: (GetVersionVector:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound
Anonymous
October 22, 2010
Make sure you post any bug reports on the code gallery site so Steve can see and track them.Anonymous
October 22, 2010
The comment has been removedAnonymous
November 16, 2010
The comment has been removed