Automating the process of starting and stopping virtual machines on VMware ESX\ESXi
search cancel

Automating the process of starting and stopping virtual machines on VMware ESX\ESXi


Article ID: 326330


Updated On:


VMware vSphere ESXi


This article explains how to configure the virtual machines to start and stop automatically when powering an ESX Server host on and off. These settings are set on a per host basis. If you vMotion the virtual machine off the host, the settings are not retained.


VMware ESX Server 2.5.x
VMware ESX Server 3.0.x
VMware ESX Server 1.x
VMware ESXi 4.0.x Embedded
VMware ESX Server 2.0.x
VMware ESXi 4.1.x Installable
VMware ESX Server 1.5.x
VMware vSphere ESXi 5.5
VMware ESXi 4.0.x Installable
VMware ESXi 4.1.x Embedded
VMware vSphere ESXi 5.1
VMware ESXi 3.5.x Installable
VMware ESX 4.0.x
VMware vSphere ESXi 6.0
VMware ESX 4.1.x
VMware ESX Server 2.1.x
VMware ESXi 3.5.x Embedded
VMware vSphere ESXi 5.0
VMware ESX Server 3.5.x


ESX 4.x, ESXi 5.x, and 6.0

Note: Automatic Startup- and Shutdown settings for virtual machines are only used when the ESXi host is actually being shut down or started. The feature does not trigger for maintenance mode. When you attempt to set an ESXi host into maintenance mode, you will need to manually shutdown the VMs for the task to be finished. Likewise, after the host has left maintenance mode, you need to manually startup the virtual machines, as they won't be automatically started.

Note: The Virtual Machine Startup and Shutdown (automatic startup) feature is disabled for all virtual machines residing on hosts that are in (or moved into) a VMware HA enabled cluster. Automatic startup is not supported when the virtual machine is HA enabled. As a result, starting with vCenter Server 5.0 Update 1, the Allow virtual machines to start and stop automatically with the system is available though enabling this feature has no affect at this time.

VMware vCenter server 4.x, 5.x, and 6.0 includes the ability to configure startup ordering. To configure these startup options:

  1. Access the settings:
    1. Give focus to the host in vCenter.
    2. Click the Configuration tab.
    3. Select Virtual Machine Startup / Shutdown under Software.
    4. Click Properties in the upper right hand side of the window.
  2. Select the options you want:
    1. In order to be able to configure any options, enable Allow virtual machines to start and stop automatically with the system.
    2. Enter a value for the Default Startup Delay, in order to delay the startup activity for a period of time after the boot process completes.

      Note: It may be required to shutdown the virtual machine to apply this setting if you receive the error:

      The attempted operation cannot be performed in the current state (Powered on)
    3. Enter a value for the Default Shutdown Delay, in order to delay the shutdown activity for a period of time. Select the Shutdown Action to be performed:
      • Guest Shutdown, to shut down the guest gracefully. This requires an updated version of VMware Tools to be installed in the guest.
      • Power off, to abruptly stop power to the virtual machine, such as pulling the power cord on a physical machine.
      • Suspend, to pause the virtual machine at that moment in time, like hibernating a physical machine.
    4. To start up the virtual machines in a particular order, configure the three Startup Order categories:
      • Automatic: This category allows you to choose the sequence, by moving machines into this category, then arranging them in order.
      • Any order: In this category, the machines are started in whatever sequence the host prefers (more or less randomized).
      • Manual: In this category, the default, the machines are not automatically restarted. You must power them on manually.
  3. Click OK when finished.

VMware ESX 3.0 and 3.5

You can manage startup and shutdown options using the VMware Infrastructure or vSphere client.

To manage virtual machine startup and shutdown options:

  1. Log into the client and select an ESX host from the inventory.
  2. Click the Configuration tab.
  3. Under Virtual Machine Startup/Shutdown, configure your virtual machine startup options, as required.

Using vmware-cmd for ESX Server 2.1 and 2.5

Starting with ESX Server 2.1, the Management Interface provides start and stop options for virtual machines. The script was also removed and the functions provided by that script were incorporated into vmware-cmd.

For more information, see Setting Startup and Shutdown Options for a Virtual Machine in the ESX Server 2.5 Administration Guide.

The VMware Scripting API User's Manual discusses vmware-cmd command syntax. For more information, see Scripting API Developer Documentation.

Using for ESX Server 2.0.1 and earlier versions

To automatically start virtual machines, add one of these configuration options to the virtual machine's configuration (.cfg or .vmx) file:

  • autostart = true
  • autostart = poweron
  • autostart = resume

    • The true and poweron settings are treated the same.
    • Use the resume setting if you have suspended the virtual machine and want it to resume automatically.

The vmware init script calls /usr/sbin/ script. This script looks for virtual machines listed in vm-list that contain one of the preceding options in the configuration files.

If you want to automatically shut down or suspend the virtual machine as well, add one of these configuration options to the virtual machine's configuration file:

  • autostop = suspend
  • autostop = poweroff

To stagger the startup of virtual machines, add this option to each virtual machine's configuration file:

autostart.delay = n

where n is the number of seconds ESX host waits after powering on this virtual machine before it proceeds to the next virtual machine.

Example: If you add the option autostart delay = 60, ESX waits one minute after it starts this virtual machine before starting the next virtual machine.

The same is true for automatically stopping the virtual machines. Use this configuration option:

autostop.delay = n


  • You can set a maximum delay of two minutes (120 seconds) between stopping each virtual machine.
  • The stop script loops for up to a maximum of five minutes, until all virtual machines are stopped.
  • This information is documented in the comments in the /usr/sbin/ file.


Additional Information

For translated versions of this article, see: