VMware VCSA Graceful Shutdown on Powercut

I have experienced this issue a few times in the past whereby, loosing power to my ESXi host,  would make the VCSA appliance useless. In most cases, despite my troubleshooting efforts, I would have to reinstall VCSA.

However, I do have an UPS in my rack to which the ESXi host is connecting to. These are the technical details of my UPS:

My UPS comes with PowerChute Personal Edition which is an – I quote: “Easy-to-use, safe system shutdown software with power and energy management features for home computers and battery backups”. The latest version can be downloaded here.

Although this PowerChute version is quite limited to what I could do with it, I thought there must be a way to automate a graceful shutdown on my VCSA when I loose power to my rack.



As you can see in the diagram, the UPS connects to the power grid and then to the server – standard stuff. The UPS interfaces with the ESXi host via USB connectivity. The USB connection is further presented to the virtual environment, connecting to a windows VM.

It is on this VM that the magic happens.

I first installed PowerChute on the VM and cut the power off to my rack. I noticed that PowerChute registers two events in the Application log – Event ID 174 and Event ID 176:

I wanted to gracefully shut down VCSA just before the battery runs out of power. To do so, I’ve used event ID 176 as the trigger to run the script which remotely shuts down VCSA. Here is the scheduled task setup:

Feel free to download the Powershell script.

Make sure you add the “.ps1” extension once you have downloaded the file.

Download VCSA Shutdown script

This setup has been tested and works as expected.

If you find this useful, please share.


Thank you,

Rafael A. Couto Cabral • LinkedIn Profile
Cisco​ | F5 | VMware Certified • PRINCE2 Practitioner

Originally posted 2019-07-27 00:39:34.

Related Post

Comments are closed.