If you’re using DFSR for branch office replication, chances are you’re concerned about the number of files in the backlog queue. This page details a script I’ve been using to automate sending of emails, using a combination of blat and dfsrdiag.
To begin you’ll need to download Blat.
I suggest placing the Blat files within C:\Windows so that it’s automatically added to the system path; you could just use the full folder path when calling it though.
Here’s an example batch script I’m using for one replication group:
:: BATCH SCRIPT START @ECHO OFF dfsrdiag Backlog /receivingmember:hub-server /sendingmember:branch-server /rgname:domain.com\files\departments /rfname:Departments >C:\users\administrator\documents\backdept-from-branch-server.txt FOR /R "C:\users\administrator\documents\" %%F IN (backdept-from-branch-server.txt) DO ( IF %%~zF GTR 3000 (blat C:\users\administrator\documents\backdept-from-branch-server.txt -to email@example.com -server smtp.domain.com -f firstname.lastname@example.org -subject "Backlog exists: Departments incoming from Branch-Server")) EXIT pause :: BATCH SCRIPT END
Here’s a quick rundown on what this is doing:
dfsrdiag Backlog: this command generates a backlog report for the specified sending and receiving server, for the specified replication group, and outputs it to a text file.
This report looks like this:
Member Backlog File Count: 1367 Backlog File Names (first 100 files) 1. File name: DSC03752.JPG 2. File name: DSC03786.JPG 3. File name: DSC03794.JPG 4. File name: DSC03796.JPG 5. File name: DSC03809.JPG 6. File name: DSC03810.JPG
The next line in the script beginning with “FOR /R”, looks for the text file just generated, and runs logic on it.
IF %%~zF GTR 3000: If the size of the backlog report text file is greater than 3KB, then generate an email to the specified people, with the text file as the message body.
Scheduling the commands
So I’ve got 16 batch files that generate reports; 2 replications groups in two transfer directions to 4 separate locations. To reduce the number of scheduled tasks, and ensure that all 16 backlog reports aren’t run at the same time, I’ve got separate batch files that call 4 at a time, and are scheduled 5 minutes apart.