VMware Cloud Community
imesholam
Contributor
Contributor

HA Automation script

Hi,

i'm looking for a script that will run automatically after host HA.

the script should email the virtual machines name.

thanks,

Itay

0 Kudos
6 Replies
LucD
Leadership
Leadership

What exactly do you mean with "host HA" ?

Is that HA kicking in and restarting VMs when one ESXi node goes down ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
imesholam
Contributor
Contributor

Hi Luc,

the meaning is that after the host got HA, the virtual machines are restarting on another host.

i need to know which VM's was restarting on the other hosts.

0 Kudos
LucD
Leadership
Leadership

Sorry, still not getting your question.

What exactly do you mean with "after the host got HA" ?

Is that when you enable HA on the cluster ?

Or is that HA taking action when an ESXi node in the cluster goes down ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
vin01
Expert
Expert

Do you mean some thing like this..

Get-VIEvent "vSphere HA restarted virtual machine"

Regards Vineeth.K
0 Kudos
imesholam
Contributor
Contributor

ok it's nned to ne in that order:

let say that esx host was crushed abd the virtual machines was restart on another host in the cluster.

i need to run a powershell script that will sen an email with the restarted virtual machines name.

0 Kudos
LucD
Leadership
Leadership

In that case the answer pointed to should do the trick.

Just add a Send-MailMessage cmdlet to send the email.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos