Does anyone know how to shutdown the CVM through REST API or PowerShell? I am trying to put together a script that would put the ESXi host in maintenance mode and would like to gracefully shutdown the CVM via script, after all other VMs on the host have been evacuated.
Best answer by Explorer
Invoke-VMScript -VM $CVM -ScriptText $script -GuestUser $CVM_UserName -GuestPassword $CVM_Password
So, pass the shutdown command (cvm_shutdown -P now) as ScriptText and let PowerCLI run it.