Hi All,
I am looking for a script to check about 5 vCenters to see what alarms are disabled whether it's on a host, a cluster or even a datacenter. And that I would like that emailed to me with only those objects that are disabled.
The exclamation mark (-not) is missing in the Where-clause.
It should be like this
$toAddr = 'me@me.com'
$fromAddr = 'me@me.com'
$smtpServer = 'smtp@me.com'
Send-MailMessage -To $toAddr -From $fromAddr -Subject 'Disabled Alarms' -SmtpServer $smtpServer -BodyAsHtml -Body (
Get-VMHost |
where{!$_.ExtensionData.AlarmActionsEnabled} |
Select @{N='vCenter';E={$_.Uid.Split('@')[1].Split(':')[0]}},Name |
ConvertTo-Html |
Out-String
)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference