You've probably seen this script: which can be used in conjunction with any IP-base UPS utility, the real question is if you're using free version of ESXi or not. If you're, then you will not be able to use the script nor any RCLI/vCLI commands issued to a ESX(i) host to shutdown VM(s) and the host. You do have the option of unlocking the unsupported busybox console and using vimsh to shutdown the VMs and then the host.
Note: The script works on ESX(i) 3.5u2/u3 due to the bug in VMware API code and the reason it doesn't work on ESXi 3.5u4 or 4.0 is the API has been fixed, many user's don't read the entire documentation.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Comuunity
Twitter: @lamw
If you find this information useful, please award points for "correct" or "helpful".