7 Replies Latest reply on Nov 9, 2019 6:22 AM by LucD


    Sebbee Lurker

      Im confused about how to shut down my ESXI host.

      Will this command (Stop-VMHost) also stop all running VM-guests gracefully?

        • 1. Re: Stop-VMHost
          LucD Guru
          Community WarriorsvExpertUser Moderators

          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.

          • 2. Re: Stop-VMHost
            Sebbee Lurker

            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?

            • 3. Re: Stop-VMHost
              LucD Guru
              User ModeratorsCommunity WarriorsvExpert

              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



              • 4. Re: Stop-VMHost
                Sebbee Lurker

                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 -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:

                • 5. Re: Stop-VMHost
                  Sebbee Lurker

                  Seems like inserting images doesnt work. And no edit button in this forum?

                  Success: https://i.imgur.com/PD6plQa.png

                  This pops up when pressing shutdown in gui, even tho AutoStartManger-policy is set: https://i.imgur.com/xVqelti.png

                  • 6. Re: Stop-VMHost
                    LucD Guru
                    Community WarriorsvExpertUser Moderators

                    That might be what the Force switch is doing.
                    I don't think you have that option in the Web Client.

                    • 7. Re: Stop-VMHost
                      LucD Guru
                      vExpertUser ModeratorsCommunity Warriors

                      Editing an existing entry can be done via Actions.


                      And adding images is in option in the edit window menu