I have used this to first shutdown my vm guests, then ESXi hosts. You must have the -f or --force to enable shutdown of a host not in maintenance mode. -o shutdown -f -a poweroff --server <your server> --username <username> --password <password>

I know this is an older post but this may help others in the future.

I also have one unanswered piece of this puzzle that someone maybe can help with. Does the "-a poweroff" gracefully shutdown the vm guests or does it "cut the power" to the vm guests? -if anyone can answer that it would be an added bonus.