Microsoft's official enterprise support blog for AD DS and more
Hi folks. Our buddy Steve Grinker has posted an excellent sample PowerShell script for retrieving DFSR backlogs over the MS Code Gallery site:
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:
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
Thanks Ned! Hopefully someone else can make use of the script... I should point out that I think I got my wires crossed somewhere in the script logic. Everyone should note that on the current release, the returned Sending / Receiving members appear to be reversed from the testing I was just doing. I will get an updated post up soon, and make a note here too that it has been corrected.
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.
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 ;-)
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!
Getting an error:
PS D:\> .\Get-DFSRBacklog.ps1
Method invocation failed because [System.Object] doesn't contain a method nam
At D:\Get-DFSRBacklog.ps1:162 char:82
+ $Vv = $InboundPartnerWMI.GetVersionVe
ctor <<<< ().VersionVector
+ CategoryInfo : InvalidOperation: (GetVersionVector:String) ,
+ FullyQualifiedErrorId : MethodNotFound
Make sure you post any bug reports on the code gallery site so Steve can see and track them.
What he said... thanks, Ned!
Oh, and if you do post to code gallery, please be sure to include the OS version of both the client and server computers involved. By client, I mean the system on which you are running the script. By server, I mean the target computer you are pointing the script at. I can't make any promises on when I may be able to troubleshoot, but I'll see what I can find.
For anyone interested, I have just posted "Release 3" of the script (now renamed with a "_v2" to separate them). By request, the new version accepts either one -RGName or -RFName to speed up the results if needed. Both parameters can be used, but the script currently only accepts one value for each parameter. Please post any additional feedback, issues, or other requests to the MS Code Gallery site (code.msdn.microsoft.com/GetDFSRBacklog) I can't make any promises on when I might get to it, but I will check occasionally. Any other general comments can be left in either location, but I don't want to hijack this blog post with any troubleshooting. :)