Yeah, I was hoping to avoid SSH and use the CLI tools. But I'm not sure one is any safer or more secure than the other really. I built the rest of the monitoring and shutdown of the VM's around the CLI tools, but the actual ESXi host shutdown seems to require the paid license (weird).
[root@ida ~]# cat Scripts/Cron/foo_off.sh
#!/bin/bash
H="foo.bar.gov"
U="admin"
P="PASSWORD"
VM=(`/usr/local/bin/vmware-cmd -H $H -U $U -P $P -l`)
POWERSTATUS=`upsc tripplite@localhost | grep ups.status | awk '{print $2}'`
if [ $POWERSTATUS == OL ]; then exit; fi
VMON=();
for machine in ${VM[@]}
do
VMON=(${VMON[@]} $machine);
done
for ((;;)) do
for test in ${VMON[@]}
do
STATE=$(/usr/local/bin/vmware-cmd -H $H -U $U -P $P $test getstate | tail -1 | awk '{print $3}')
if [ $STATE == off ]
then
VMON=(${VMON[@]:0:$((${#VMON[@]}-1)))});
fi
if [ ${#VMON[@]} == 0 ]
then
/usr/bin/vicfg-hostops vmware-cmd -server $H -username $U -password $P --operation shutdown --force
/usr/bin/logger -p syslog.alert -t upssched-cmd "Shutting Down FOO"
exit
fi
done
sleep 5
done