切换到宽版
  • 6535阅读
  • 1回复

[求助]使用脚本检查SCR的状态和邮件结果 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 0楼  发表于: 2011-03-21
— 本帖被 YOYO 从 Exchange 脚本中心 移动到本区(2015-06-25) —
  • 脚本环境:PowerShell
  • 适合版本:Exchange 2007
  • 适用平台:
使用此脚本可以检查SCR的状态和邮件结果。

$SCRStatus = Get-StorageGroupCopyStatus -Server PRIMARYSERVER -StandbyMachine SECONDARYSERVER | Where {$_.StorageGroupName -eq “First Storage Group”}
if ($SCRStatus.SummaryCopyStatus -ne “Healthy”)
{
$MessageBody = “The SCR for ” + $SCRStatus.StorageGroupName + ” has failed”
$FromAddress = [email=“FromAddress@yourdomain.com]“FromAddress@yourdomain.com[/email]”
$ToAddress = [email=“ToAddress@yourdomain.com]“ToAddress@yourdomain.com[/email]”
$MessageSubject = “SCR Status Failure”
$SendingServer = “MAILSERVER”
$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
{
Write-Host “First Storage Group All Good!”
}
$SCRStatus2 = Get-StorageGroupCopyStatus -Server PRIMARYSERVER -StandbyMachine SECONDARYSERVER | Where {$_.StorageGroupName -eq “Second Storage Group”}
if ($SCRStatus2.SummaryCopyStatus -ne “Healthy”)
{
$MessageBody = “The SCR for ” + $SCRStatus2.StorageGroupName + ” has failed”
$FromAddress = [email=“FromAddress@yourdomain.com]“FromAddress@yourdomain.com[/email]”
$ToAddress = [email=“ToAddress@yourdomain.com]“ToAddress@yourdomain.com[/email]”
$MessageSubject = “SCR Status Failure”
$SendingServer = “MAILSERVER”
$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
{
Write-Host “Second Storage Group All Good!”
Exit
}
分享到
只看该作者 1楼  发表于: 2011-03-28
mark  这个决对用得到!
快速回复
限60 字节
 
上一个 下一个