Save the attached file (checkReplication.ps1) to a directory on the Active Directory server you'd like to monitor. You'll need to schedule it using Task Scheduler. If you haven't changed the execution policy on that server yet, you can do so by opening PowerShell and entering the following:
Set-ExecutionPolicy Unrestricted
In Task Scheduler, create a new basic task.
- Name can be 'Check Replication' or something similar
- Trigger can be daily (you can tweak that later if you'd like to check more frequently)
- Action is going to be 'Start a program'
- Program is powershell.exe
- Argument is -File "C:\scripts\checkReplication.ps1" (update with the actual location you saved the PowerShell script).
Ok! Next step is creating the check in CheckCentral. Add a new check and use the following settings:
- Frequency: scheduled
- Schedule Type: regular interval
- Emails are expected: every 24 hours
- Set as failed when an email is late: after 90 minutes
Copy the email address that is displayed here and update the checkReplication.ps1 script with it (it's the $msgAddress variable)
- Default Status: Failure
- Success Rule: check the Condense Whitespace box, and Body Text - Complex Match - "0 / 5"{4}
Complex matches are pretty powerful, and in this instance we're telling CheckCentral to look at the output of the command and to count how many times "0 / 5" shows up, and to only mark the check as successful if that string appears exactly 4 times. Now, this is just for two Active Directory servers. If you have more in your environment, just open up a command prompt on an Active Directory server and run repadmin.exe /replsummary and have a look at the output. When I run this, I want to make sure there are 0 / 5 errors for each of the entries listed. In this particular environment, that's 4 times, and that's where the {4} comes from above. If you have more servers, that number is going to be higher, so just enter that in instead.
Save your check, and try running your scheduled task. If all is well, an email should show up under Recent Activity, and hopefully the dot is green!