Is the ESXi node part of a cluster that has DRS enabled?
If it is not, the Stop-VMHost will come back with an error when there are powered on VMs on the node.
If you add the -Force parameter, the power off will take place, effectively killing, not a graceful shutdown, the active VMs.
Those VMs will be left with the 'Disconnected' indication.
No, it's a standalone host.
So I need to do a "Stop-VMGuest" on every guest first?
My problem is that I want to initiate the shutdown via PowerCLI from one of the hosts running on that exact ESXI-host..
So... if I do "Stop-VMGuest " on all guests first, then I cant do the STOP-VMHOST from anywhere :P
Is there no way to "tell" esxi to shut-down but also power-off the guests gracefully?
You can configure the autostart actions for a standalone ESXi node.
For example, this will tell the ESXi node to shutdown down the VMs gracefully when the node is powered off.$esx = Get-VMHost -Name MyEsx
$auto = Get-View -Id $esx.ExtensionData.ConfigManager.AutoStartManager
$spec = New-Object VMware.Vim.HostAutoStartManagerConfig
$spec.Defaults = New-Object VMware.Vim.AutoStartDefaults
$spec.Defaults.Enabled = $true
$spec.Defaults.StopAction = [VMware.Vim.AutoStartAction]::guestShutdown
Hello, big thanks for your help!
It actually worked. It's so strange that the webgui still says that it wont do a graceful shutdown when I click shutdown without being in maintenancemode, but it does anyway.
This is the output after running (yeah, I chickened out and powered down all manually except one I dont care about before testing :P )
Stop-VMHost -VMHost 192.168.1.8 -force -Confirm:$false
I also confimed in in the guest operating system:
dockerdebian:~$ last -x shutdown
shutdown system down 4.19.67 Sat Nov 9 14:39 - 14:48 (00:08)
But it still bugs me that pressing the shutdown-button in the gui gives this:
That might be what the Force switch is doing.
I don't think you have that option in the Web Client.