Variation or b*stardization of LucD's (thank you thank you)
Errors on alarms not enabled I think (so pulling them out) and exporting the results to csv.
get-alarmdefinition -enabled $true | get-alarmaction -ActionType SendEmail | Select @{N="Alarm name";E={$_.AlarmDefinition.Name}}, @{N="Email";E={[string]::Join(',',($_.To))}} | export-csv c:\temp\alarms.csv
No issues with LucD's on a 5.1 VCSA or a 5.0 Win vCenter, but another 5.0 VCSA barfed on LucD's & worked with my script. Could be some other difference between the vCenters that caused it, but I'm going to assume it's all the disabled alarms from a 3rd party plugin.
Here's the error:
Get-AlarmAction : 3/8/2013 7:01:22 PM Get-AlarmAction Object reference not set to an instance of an object.
At line:1 char:16
+ Get-AlarmAction <<<< -ActionType SendEmail | Select @{N="Alarm name";E={$_.AlarmDefinition.Name}}, @{N="Email";E={[string]::Join(',',($_.To))}}
+ CategoryInfo : NotSpecified: (:) [Get-AlarmAction], ViError
+ FullyQualifiedErrorId : Client20_AlarmServiceImpl_GetAlarmAction_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Alarm.GetAlarmAction
Message was edited by: kattrap - posted wrong error message the first time around