Hello Everyone -
I have a script that I found from the web and wanted to use it to help send us email notifications on the status of our SCR replication health. We have 8 SCR Storage groups being replicated from 2 different email servers (4 from each server) and I wanted to if someone can help me figure out how to make it so it reads from both servers vs creating the below script 8 times and getting 8 separate emails. The script is below
$SCRStatus = Get-StorageGroupCopyStatus -Server Server1 -StandbyMachine SCRServer | Where {$_.StorageGroupName -eq “SG1”}
if ($SCRStatus.SummaryCopyStatus -eq “Healthy”)
{
$MessageBody = “The SCR for ” + $SCRStatus.StorageGroupName + " is Healthy”
$FromAddress = “Exchange SCR Health <no_reply@Domain.com>”
$ToAddress = “User@Domain.com”
$MessageSubject = “SCR Status”
$SendingServer = “ServerName”
$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody
$SMTPMessage.IsBodyHtml = $true
$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
$SMTPClient.Send($SMTPMessage)
}
Else
{
$MessageBody = “The SCR for ” + $SCRStatus.StorageGroupName + " has Failed”
$FromAddress = “Exchange SCR Health <no_reply@Domain.com>”
$ToAddress = “User@Domain.com”
$MessageSubject = “SCR Status”
$SendingServer = “ServerName”
$SMTPMessage = New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody
$SMTPMessage.IsBodyHtml = $true
$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
$SMTPClient.Send($SMTPMessage)
}