I own a Dell PE R620 server running ESXi 6. Fortunately for me, it has a iDRAC7 enterprise licensed card installed that lets me remotely power on and off the server module via scripting – on click of a button.
Power On
This script logs into the iDRAC via SSH and switches on the server module thus booting up the ESXi OS.
#PowerON.bat
#iDRAC7 IP = 192.168.1.5
plink -l root -pw xxx 192.168.1.5 racadm serveraction powerup
Options –
- powerdown – Powers down the server module
- powerup – Powers up the server module
- powercycle – Issues a power-cycle to the server module
- hardreset – Issues a hard reset to the server module
Power Off
I haven’t experimented with it, but my understanding is, the power-off command shouldn’t be signaled through racadm (racadm serveraction powerdown
) method as it might not gracefully shutdown the running VMs on the ESXi. It seems crude enough for me not to explore this option.
Therefore, I opted to SSH into the ESXi CLI and execute shutdown commands. Every VM must have vmtools installed to receive the shutdown signalling from the ESXi host.
#PowerOFF.bat
#ESXi IP = 192.168.1.6
plink -l root -pw xxx 192.168.1.6 (/sbin/shutdown.sh;/sbin/poweroff)
Summary
This has been working well for the past few weeks. You have to remember to set appropriate autostart parameters on your ESXi for the VMs to take benefit of this method.