检查磁盘利用率并且定期发送告警邮件

$c = Get-WmiObject -Class Win32_LogicalDisk | where {$_.size} | select-object -Property deviceid, @{N='Free';E={[System.Math]::round($_.freespace / $_.size * 100)}} | Where-Object -FilterScript {$_.deviceid -eq "c:"}
if ($c.free -le 10) {Send-MailMessage -SmtpServer 172.17.9.119 -From ALERT@COMPANY.COM -To san.zhang@tcs.com -Subject "Hard Disk Alert" -Body "The hard disk utilization is HIGN!!!"}

 

posted @ 2015-05-11 09:46  dongdonggeorge  阅读(274)  评论(0编辑  收藏  举报