Configuring all the alarm actions on a new vCenter build can be quite cumbersome, so I wrote the following script to speed up the process. The script adds a new email alarm action for all the specified alarms and adds two triggers (green > yellow, yellow > red).

Import-Csv alarms_to_configure.csv | Foreach {
$alarm = $null
Get-AlarmDefinition $_.Alarm | New-AlarmAction -Email -To ""
$alarm = Get-AlarmDefinition $_.Alarm | Get-AlarmAction -ActionType SendEmail
$alarm | New-AlarmActionTrigger -StartStatus Green -EndStatus Yellow

alarms_to_configure.csv contents are as below.

vSphere HA Host Status
vSphere HA virtual machine failover failed
vSphere HA virtual machine monitoring action
Insufficient vSphere HA failover resources

Credit to Angel Evrov, as I expanded on his VMware blog.

Any comments or suggestions welcome.