标签:for 邮件告警 dhcp system smtps odi 发邮件 address ipad
检查DHCP IP分配情况,Scop IP分配超过80% 发邮件告警#IP分配大于80% 发邮件告警
$percentage = 80
#Send-MailMessage -From $FromEmail -To $ToEmail -subject $Subject -Body $body -SmtpServer $SMTPServer -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8)
$Statistics = Get-DhcpServerv4ScopeStatistics
if ( $? -eq $True )
{
foreach ($scop in $Statistics)
{
if ($scop.PercentageInUse -gt $percentage)
{
$subject = "DHCP " +($scop.ScopeId).IPAddressToString + " In Use: " + $scop.PercentageInUse
$body = " scop: " + ($scop.ScopeId).IPAddressToString
$body += " InUse: " + $scop.InUse
$body += " Free: " + $scop.Free
$body += " PercentageInUse: " + $scop.PercentageInUse
Send-MailMessage -From $FromEmail -To $ToEmail -subject $Subject -Body $body -SmtpServer $SMTPServer -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8)
}
}
}
标签:for 邮件告警 dhcp system smtps odi 发邮件 address ipad
原文地址:http://blog.51cto.com/13804335/2140897