标签:src health order ack 信息 需要 img body erro
此脚本是群里面的哥们共享的,本人特整理出来分享给有需要的同学。注意:
1.使用前修改下里面的一些参数(原作者都贴心的标注了)
2.有必要的话修改下脚本的执行策略
效果截图:
计划任务截图:
脚本内容:
add-pssnapin microsoft.exchange* #加载EMS不然exchange命令无法识别
$seei = $Sear.ErrorEventId
$OutDB += "<tr style=""font-size:12px; font-family:‘微软雅黑‘;$trbgcolor"" align=""center"">
<td height=""30"">$mbs</td>
<td>$sdn</td>
<td bgcolor=""$bordercolor"">??$SStatus??</td>
<td bgcolor=""$bgindex"">??$SConIndexState??</td>
<td>??$scql??</td>
<td>??$srql??</td>
<td>??$sac??</td>
<td bgcolor=""$bordercolor"">??$sem??</td>
<td>??$seei??</td>
</tr>"
}
$Output = "<font size=""1"" face=""Arial,sans-serif"">
<h3 align=""center"">Exchange 数据库运行状态报表</h3>
<h5 align=""center"">生成时间 $((Get-Date).ToString())</h5>
</font>
<table width=""100%"" bordercolor=""#FFFFFF"" border=""0"" cellspacing=""2"" cellpadding=""0"">
<tr style=""background-color:#090; color:#FFF; font-size:14px; font-family:‘微软雅黑‘;"" align=""center"">
<td height=""30"">服务器名称</td>
<td>数据库名称</td>
<td>状态</td>
<td>内容索引状态</td>
<td>复制队列长度</td>
<td>重播队列长度</td>
<td>是否为主动库</td>
<td>错误信息</td>
<td>错误事件ID</td>
</tr>
$OutDB
</table>
<br><br><h5 align=""center"">错误代码及错误信息</h5><br>
<table width=""100%"" bordercolor=""#FFFFFF"" border=""0"" cellspacing=""2"" cellpadding=""0"">
<tr style=""background-color:#f90; color:#FFF; font-size:14px; font-family:‘微软雅黑‘;"" align=""center"">
<td>错误代码</td>
<td>错误内容</td>
</tr>
$errmes
</table>
"
function sendmail($body)
{
$today = Get-Date
$SmtpClient = new-object system.net.mail.smtpClient
$mailmessage = New-Object system.net.mail.mailmessage
$SmtpClient.Host = $Smtp
$mailmessage.from = $EmailSender
$mailmessage.To.add($AdminEamil)
$mailmessage.Priority=[system.net.mail.MailPriority]::High
$mailmessage.Bcc.add("zhangdl@qunar.com") #需要修改处
$mailmessage.Subject = “[Report] Exchange 数据库运行状态报表”
$mailmessage.IsBodyHtml = $true
$mailmessage.Body += "`n" + $body
$smtpclient.Send($mailmessage)
}
sendmail $Output
标签:src health order ack 信息 需要 img body erro
原文地址:http://blog.51cto.com/seawind/2335919