Running this script in the PowerShell ISE will give you a nice output comparing the server you’re running it on with the other connection members in the replication group(s) it belongs to.

You will see “warnings” highlighted in yellow and “errors” highlighted in red.

  • Since this was ran in a production environment I had to blur out the server names and replication group names.

 

 

It uses WMI to query the DFS Replication Groups and further gather the backlog statistics.

 

Copy the code below into PowerShell ISE and run it!

 

I have modified the script for my environment to send the results via e-mail, but I’d like to polish that up a little more if I am going to share it.

 

I hope this helps you!

 

Update 2/6/2018:

I updated the script with ability to email the results.

At line 31 it starts a transcript of the PS session and saves it at C:\scripts\dfsr1.txt

Lines 100 and beyond are where the output file is processed for email and actually sent.

  • I was sending through an open mail relay that does not need authentication.
  • If you need authentication for the SMTP server,  you will have to modify the Send-MailMessage line

 

 


5 Comments

John · April 25, 2018 at 11:04 am

Hi Tyler, this is a nice script. I was looking for this long time. Great job.
I am getting all result on the screen , but not in the email body.
The email body is listing only the last three lines.Any suggestions?

    Tyler Woods · April 25, 2018 at 2:37 pm

    Did you copy+paste from the example I shared? I’m not able to test this against an environment right now, but I pulled that snippet from my repository of production scripts.

    I would ensure the start-transcript is up at the proper location, and you can also double check the .TXT file to see what its contents are as a way to diagnose if the problem is with sending the body of the message or with saving the transcript of the session.

    thanks!

Nick · February 7, 2018 at 8:32 am

Hi Tyler, this is great, thanks!
Did you ever get the emailing of results part working?
Thanks

    Tyler Woods · February 7, 2018 at 8:49 am

    Yes I did! I am going to update the post since posting the script in the comments doesn’t exactly work well. Thanks!

    Tyler Woods · February 7, 2018 at 8:58 am

    Nick, the post has been updated with the method I used for emailing the results.

Leave a Reply