We researched scripts to shutdown ESXi 5.0 and found a solution. We did optimize the script to first shutdown all virtual machines and finally ESXi 5.0.
Note: Do not upgrade to ESXi 5.1. This version does not allow remote shutdown per script any more.
Please contact us for any inquiries.