I'm trying to write a script that ssh's to an ESXi 6.7 and shuts down the host and also shuts down the VMs according to the current system shutdown policy.
I'm running Dell customized image ESXi 6.7 in a Dell R710 with a dual Xeon X5650 and 144GB RAM.
In fact what I want is the same that I can get with:
I have ssh enabled in the server.
I already tryed:
host_shutdown.sh (it just gets there indefinitely).
/bin/host_shutdown.sh (it to gets there indefinitely).
halt (shutdowns the server but it does not shuts down the VMs)
I also tried:
esxcli system shutdown poweroff --reason I_want_IT
but the system must be in maintenance mode and I want to do it without entering maintenance mode
I then discovered this thread here in Server Fault, but it does not work in my environment as it is PowerCLI and I'm want to run the script from a Raspberry Pi:
I think I'm too dumb to discover on my own how to do it, because I presume it must be a simple thing to do.