Powershell – Check DFS Backlog Windows Server 2012 R2

The DFS Get-DFSRBacklog cmdlet is OK, but the problem is that by default it only reports  a maximum of 100 files in the backlog. The following script shows you have to get the real amount and it looks so you can keep any eye on it increasing or decreasing!

If you run the Get-DFSRBacklog cmdlet , it will return a count of 100 maximum. Which is not any real use if you are wanting to know how long a backlog of 500,000 files is going to take – trust me – I needed to know!

If you run the cmdlet with the -Verbose parameter will tell you exactly how many are in the queue, but how do you get that into a format you can report on?

First you have to redirect the verbose output stream to the success output stream

Scroll to the bottom to see the code.

So basically the

redirect the verbose  to the success stream

Then we wrap the command in brackets to return the result and process it a bit more

If you pipe the command through get- member

You will see that there is a message property. So if you go

You will get the verbose message back

We then use the split() method to split the message up into an array using  the : character as the delimiter and we return the 3rd item in the array (arrays start at [0]  )

In the script below I just loop forever, so it just prints a time-stamped line to the console every 10 seconds to tell me how many items are in the backlog queue




One thought on “Powershell – Check DFS Backlog Windows Server 2012 R2

Leave a comment

Your email address will not be published. Required fields are marked *