Home » Exchange Server » Using Test-ReplicationHealth to Troubleshoot Database Availability Groups

Using Test-ReplicationHealth to Troubleshoot Database Availability Groups

Database availability groups are reasonably smart and robust systems, but they do need monitoring, or else you might find one day they are not providing the HA that you need them to. One of the useful PowerShell cmdlets for keeping an eye on things is Test-ReplicationHealth. It can be used to help troubleshoot database availability groups by running it locally or against a remote server.

To test a remote server, use the -Identity parameter.

The cmdlet also accepts pipeline input, however if you were to simply pipe Get-MailboxServer into it and you have Mailbox servers in the organization that are not DAG members then you risk seeing errors in your results that just get in the way. Instead you can pipe only the members of a database availability group into Test-ReplicationHealth using the following method:

The number of tests shown in the output of Test-ReplicationHealth will vary depending on which version of Exchange you’re running, and whether the DAG member has only active or passive databases on it at the time. Not all tests are relevant if the server has only active, or only passive databases on it.

There’s a lot of output to look at, so it’s often easier to filter the results to only those that have not passed.

The error details are usually truncated, so outputting the results as a list will let you see more information.

By the way, if you’re curious about what each of the tests do, there’s a “CheckDescription” provided for each of the checks that Test-ReplicationHealth performs. Some of them are still a bit vague, but there’s some useful info there that can help point you in the right direction to investigate further.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server


  1. Ryan says:

    Hi Paul, what are the next steps if you get a failure from Test-ReplicationHealth? We are running Exchange 2010 and despite seeing no ill effects all 12 members of our three DAG’s are now failing with:

    The health test of the Microsoft Exchange Server Locator Service on server ‘DAG-MEMBER’ failed.
    Error: Server Locator Service call had a communication error.

    Searching the for this error it does’t seem to appear in any MS documentation so we’re at a bit of a loss of how to proceed before contacting MS.

    Many thanks, Ryan.

    • According to TechNet that…

      “Verifies the Active Manager client/server processes on DAG members and on the Client Access Server that perform lookups in Active Directory and Active Manager to determine where a user’s mailbox database is active.”

      I don’t see any info out there on what to do about it. Are there any other event log entries that might be relevant? Particularly events that may be logged when the server restarts?

      • Ryan says:

        Thanks for the advice Paul, I tried rebooting a DAG member but couldn’t see anything useful so investigated further…

        This issue only came to light because we run Test-ReplicationHealth for each node daily and email an alert on failure. The Server Locator Service error first appeared last month and then disappeared before returning last week. It would always affect all servers or none.

        We are in the process of updating from SP2 to SP3 and it seems the Test-ReplicationHealth results vary depending on where you run the cmdlet. If run on SP3 we don’t see ClusterNetwork, QuorumGroup and FileShareQuorum checks but gain the ServerLocatorService failure.

        The server running the daily health checks would connect to a different Exchange server each day thus we got differing results. So far we’ve only upgraded our CAS and HT servers so hopefully once we complete the mailbox servers the ServiceLocatorService will report healthy.

        Thanks again for initial advice though Paul 🙂

        • I suppose that would make sense that running from a down level server might throw some odd results for higher SP level servers. Though I’ve never run into that issue myself, because I generally run monitoring scripts from the highest version/SP level in the org.

  2. Miko Tupaz says:

    Hi Paul,
    Would you happen to have the firewall ports required for this to work? We have an exchange site behind a firewall and not getting any results when I run this test.

  3. Simon Craner says:

    Hi Paul,

    thanks once again for excellent work. Just like the test-exchangehealth script, I would like to have this output to an email that my team could get say twice a day, i.e. at the typical working start time of the day and before we go home for the day.
    Any assistance to help generate it will be greatly appreciated.

  4. Nien says:

    Hi Paul, Thank you for the time you take to write these articles. Not only are they clear, but also help with getting a better understanding of the PowerShell cmdlets.

Leave a Reply

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