Exchange CCR Health Script

Posted by in Exchange, PowerShell

Download the script here: Get-CCRHealth Script

If you administer a multi CCR cluster environment then it’s useful to know the specific state of your server without having to go and look for it. I find monitoring screens that offer a quick glance on health really useful, so for the purpose of this blog I have cleaned my script up a bit and have adapted it to offer 3 output types.

First of all, I need to stress that you need to run this script from a server with Windows Failover Clustering feature installed. Unfortunately, there is no way round this that I have found so far. I’m pretty sure you’ll also need PowerShell 2.0 for this to run successfully.

Before you start running this script you’ll need to change a few variables at the top of the script:

# Variables
$ReportPath = "C:\Scripts\CCRHealth.htm"
$EmailSubject = "Exchange CCR Health Report"
$FromAddress = ""
$RecipientAddress = ""	# Comma separate for more than one.
$SMTPServer = ""		# Hostname or IP Address.

First off, we have the normal shell view. You can run the script with no switches and it will automatically query every CCR cluster in your estate and give you the health on the screen.

Console output for Get-CCRHealth.ps1

Second, we have the -Email switch. This will send you an HTML formatted email with the details.

Email output for Get-CCRHealth.ps1

Third, we have the -Report switch which will create an HTML report. The path of the output can be configured in the variables section of the script. This is what I use for my monitoring screen, as I can schedule this to run every 5 or 10 minutes and have a browser auto refresh the report. You have no idea how many times this has saved my life and reported stuff before SCOM has bothered to tell me.

HTML report output for Get-CCRHealth.ps1

Fourth, we have the -Alert switch which can be used in conjunction with the  -Report or -Email switch. I use this with the -Report switch and it means that if any CCR clusters fall into a ‘Failed’ state I get an email alert telling me.

I hope someone finds this script useful. Please feel free to modify and let me know if you manage to do anything really cool with it. As a point of note, you may want to change the values at which copy queue length and replay queue length change colour. This logic can be found around line 192.

Download the script here: Get-CCRHealth Script