check exchange replication – powershell task

a client had some wan issues, the exchange dag didn’t like it, this script will detect and resume automagically 🙂
[powershell]
$h = Get-MailboxDatabaseCopyStatus -ident "Main Database\EXCHANGE-DR"
$c = $h.CopyQueueLength
$s = $h.Status
if ($c -gt 0){
Resume-MailboxDatabaseCopy -Identity "Main Database\EXCHANGE-DR" -ReplicationOnly -confirm:$false
Write-Host "Resuming"}
elseif ($c -eq 0){Write-Host "we are good"}
if ($s -ne "Healthy"){
Resume-MailboxDatabaseCopy -Identity "Main Database\EXCHANGE-DR" -ReplicationOnly -confirm:$false
write-host "Detected not Healthy status, resuming"}
[/powershell]

Leave a Reply

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