Customers frequently ask us for a way to automatically generate health reports for multiple replication groups. I'm pleased to provide a sample script and instructions, provided by Dan Boldo and Jeff Carollo, respectively. Click here to view the sample script.

--Jill

Automating DFS Replication Health Reports
DFS Replication (DFSR) health reports are an excellent mechanism for monitoring replication status.  Health reports can be generated by the DfsrAdmin.exe command line utility or via the DFS Management UI.  The command-line interface makes DfsrAdmin.exe the better tool for health report automation. 

A health report can only be generated for one replication group at a time. As such, DfsrAdmin.exe must be run once for each replication group that an organization wishes to monitor. Organizations with many DFSR replication groups will find that manually generating daily health reports to be a tedious task and may opt to use an enterprise ready solution, such as MOM. In any case, automation saves time.  Organizations with several replication groups are strongly encouraged to automate health report generation.

The recommended way to automate DFS Replication health report generation is to schedule a regular task that uses DfsrAdmin.exe to generate a health report for each replication group that an organization wishes to monitor.  This involves a two step process:

Step 1: Create a command script that generates the desired health reports
I have provided an example command script, Sample_auto_report.cmd, which generates health reports, saves them to a server share, and finally sends an email to a distribution list with links to the new health reports. Please feel free to download this command script and modify it to meet the needs of your organization. 

Your command script can be as simple or as powerful as your organization requires. A very basic script might just delete the DFSR health reports from the previous day, and then generate new health reports using DfsrAdmin.exe. One of our customers has gone the extra distance by creating a script that generates daily DFSR health reports, parses the XML health reports for various information and statistics, and then uses that information to build daily summary emails which include status on every DFSR server in their organization. Some useful data in this customer’s daily summary emails include service state, service uptime, bytes transferred in the previous 24 hours, files received, and the inbound and outbound replication backlogs for each server. The customer’s script then creates a summary email for each geographic region, sending regional administrators only those summary emails which concern their respective region.

Step 2: Schedule the command script to run at desired intervals
The AT.exe command line utility can be used to regularly schedule tasks in Windows.  To schedule Sample_auto_report.cmd to run once every weekday at 4:00am, I issued the following command:

at 4:00am /every:M,T,W,Th,F c:\Sample_auto_report.cmd

Note: This step should be performed from an account that has sufficient privileges to run the utilities in the command script, and which also has write access to the directories where the health reports will be stored. The Schedule service must be running on the server hosting this scheduled task.

--Jeff