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
http://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

image

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

image

Make sure you set bypass execution policies, as the script is unsigned obviously.

image

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