By default, virtual machines located on VMWare ESXi (Free Hypervisor) or VMWare Workstation are not starting automatically at the host boot. It means that after the ESXi/Workstation host reboot (planned restart or crash) the Administrator has to manually start all the virtual machines. This guide will show how to configure Autostart VMs on the ESXi and VMWare Workstation host without Administrator intervention.
Table of Contents
How to Configure VM Autostart on VMware ESXi?
At first, open the browser and go to the login screen page of the VMware Web Client. Then log on. In the Web Client console, select ESXi host which you want to configure for VMs autostart. Then go to the following tab Manage > System > Autostart.
Tip. If your ESXi host is managed by the vCenter Server and is a part of the vSphere HA cluster, you can’t configure VM autostart and shutdown settings this way. This is happening because the HA cluster responds for the availability of VMs.
Viewing autostart VMs in VMware ESXi
As you can see all the virtual machines disposed on a given ESXi are not configured to start automatically (Autostart order = Unset). It means that after host reboot you will have to start them manually.
Configuring autostart for ESXi host VMs
To be booted automatically, you need to enable autostart for VM.
Select VM you want to boot automatically and click Enable.
The Autostart order field should display a value of 1. This means that this VM will boot first after the ESXi host boots. With the Start later and Start earlier buttons, you can manage the order in which the virtual machines start.
Configuring the boot order for automatic startup
When configuring autostart for virtual machines, the ESXi host administrator must properly configure the boot order. For example, the domain controller should be booted first, then Exchange servers or you should start the application’ server only after booting MSSQL VM, etc.
Note. You can check how to share a disk between multiple VMs on VMWare ESXi.
You can configure other parameters of VM autostart by clicking the Configure button. In the Configure Autostart window, the following options are available to fine tune the automatic VM startup.
Startup and shutdown options
There are common options for startup and shutdown behavior:
- Startup delay — how many seconds VMs wait before powering on (by default it’s 120 seconds). After the ESXi host powers up the first VM, the host waits for the specified delay time and then powers up the next virtual machine. This delay allows you to wait for booting of custom services and scripts execution;
- Shutdown delay — specifies the time delay before shutdown of each virtual machine (by default it’s 120 seconds). If the virtual machine does not shut down within the specified delay time, a hard shutdown command is sent to the virtual machine;
- Stop Action — for each VM available 4 shutdown actions: System default, Shut Down, Suspend, or Power off. Use the opportunities of VMware Tools that you need to pre-install in the guest operating system. By default used action is Shut down.
- Wait for heartbeat — if enabled, the power-up sequence continues after the virtual machine receives the first heartbeat. To do this, the VMWare tools must be installed in the guest OS of the virtual machine. After the ESXi VM boots up, go to the next VM immediately as soon as the VM tools send a heartbeat to signal its startup (instead of waiting for a startup delay interval).
The following Stop Actions are available:
- System Default — the global Stop Action settings are applied to the VM ( from Host > Manage > Autostart);
- Power Off — forced shutdown of VM. This is the equivalent of you physically pulling the power cord out of a physical computer. This action immediately kills the VM with no graceful stopping services, saving of files or cache;
- Suspend — the state of the running virtual machine (including memory, swap, CPU instructions) is saved to files on your datastore. VM can be resumed from a sleep state at exactly the same point later on;
- Shutdown — performs a graceful shutdown of VM. For this feature to work, the guest OS must have VMTools installed, which sends a command to shut down the OS properly.
Click OK to save your changes and close the dialog box.
Referer. Learn how to how to convert VMDK to VHDX.
You can configure autostart settings that will be applied to all new virtual machines on the ESXi host. To do this, click the Edit Settings button at the top of the Autostart dialog box.
To enable autostart for all VMs, change the Enabled to Yes. And select start/stop delay and stop action.
Tip. If you have not configured the HA, but it is possible to move VMs between hosts using vMotion, startup settings are migrating to the destination host with VM.
Configure Autostart of VM Using PowerCLI
Also, you can configure the auto-start setting of the VM using PowerCLI. Display a list of the auto-start action for all VMs on the host:
Get-VM –VMname * | Select-Object VMname, AutomaticStartAction
To enable Automatic Startup for all VMs which name starts with lon-, run the following command:
Get-VM –VMname lon-* | Set-VM –AutomaticStartAction Start
That’s it! You have successfully configured automatic startup for virtual machines on VMWare ESXi or vSphere Center.
VMware ESXi autostart bug workaround
In VMWare ESXi 6.0, there was a strange bug. Despite the fact that the auto-start priority for virtual machines is configured, after the host server reboot, only the first virtual machine starts automatically. The second virtual machine stubbornly refuses to boot.
Note. Check our post about RVTools.
To solve this problem, you need to enable SSH access on the ESXi and connect to the host using any SSH client (for example, Putty).
Get a list of virtual machine IDs:
vim-cmd vmsvc/getallvms
Enable force auto-start feature:
vim-cmd hostsvc/autostartmanager/enable_autostart true
Now check the VMs startup settings:
vim-cmd hostsvc/autostartmanager/get_autostartseq (vim.host.AutoStartManager.AutoPowerInfo) { key = ‘vim.VirtualMachine:1’, startOrder = 1, startDelay = -1, waitForHeartbeat = «systemDefault», startAction = «powerOn», stopDelay = -1, stopAction = «systemDefault» }, (vim.host.AutoStartManager.AutoPowerInfo) { key = ‘vim.VirtualMachine:2’, startOrder = 2, startDelay = -1, waitForHeartbeat = «systemDefault», startAction = «none», stopDelay = -1, stopAction = «systemDefault» }
As you can see, in this case, the first VM with ID 1 is set to autostart (startAction = “powerOn”), while the second one does not (startAction = “none”).
In this case, it is enough to re-register the problematic VM on the host using the commands:
vim-cmd /vmsvc/unregister 2 vim-cmd solo/registervm /vmfs/volumes/VMFS1/Lon-VM1/Lon-VM1.vmx
Check the startup parameters again:
vim-cmd hostsvc/autostartmanager/get_autostartseq
Make sure the startAction value of the new VM has changed to powerOn.
Autostart VMware Workstation Virtual Machines at Boot
The desktop virtualization software VMware Workstation also does not provide the ability to automatically startup the virtual machines at Windows boot. To start the VM from the command prompt, you can use the utility vmrun.exe. It is located in the folder with the installed Workstation.
Note. Check our guide How to convert thick provision disk to thin on VMware ESXi.
You can run any virtual machine by creating the following batch file AutoStartVM.bat.
start “C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe” “D:\VM\TestVm1\TestVm1.vmx” ping 127.0.0.1 -n 40 > nul start “C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe” “D:\VM\freebsd2\freebsd2.vmx”
The second code line is used to create a 40-second delay before starting the second VM. This bat file can be put on the desktop (and started manually by double click), added to the Windows Startup, or run by the task scheduler job.
You can also convert your virtual machine to a Shared VM (VM > Manage > Share).
Select in the main window Shared VMs > Manage AutoStart VMs.
In the open Configure AutoStart window, you can choose which virtual machines will start with the host. You can also change the delay between the start of each virtual machine (in seconds).
FAQs for Configuring Autostart of VM on VMware ESXi
- What is VM autostart and why is it important?
VM autostart is the automatic startup of virtual machines on VMware ESXi or VMware Workstation during the host boot. By default, these virtual machines do not start automatically, requiring manual intervention from the administrator. Configuring autostart allows for a more efficient workflow and ensures that essential services are up and running when needed.
- How can I configure VM autostart on VMware ESXi?
To configure VM autostart on VMware ESXi, follow these steps:
1) Open the VMware Web Client and log in.
2) Select the desired ESXi host.
3) Navigate to Manage > System > Autostart.
4) Enable autostart for individual VMs and adjust the startup order as needed.
Note that if your ESXi host is part of a vSphere HA cluster managed by vCenter Server, you cannot configure VM autostart and shutdown settings in this manner. - Can I configure autostart for all VMs on an ESXi host?
Yes, you can enable autostart for all VMs on an ESXi host by clicking the Edit Settings button at the top of the Autostart dialog box and changing the Enabled setting to Yes. You can also select start/stop delay and stop action settings. - How do I configure VM autostart using PowerCLI?
To configure VM autostart using PowerCLI, you can run commands like:
Display auto-start actions for all VMs on the host:Get-VM –VMname * | Select-Object VMname, AutomaticStartAction
Enable Automatic Startup for specific VMs:
Get-VM –VMname lon-* | Set-VM –AutomaticStartAction Start
- Is it possible to autostart VMware Workstation virtual machines at boot?
Yes, you can autostart VMware Workstation virtual machines at boot by creating a batch file with the vmrun.exe utility, adding the file to the Windows Startup, or running it as a scheduled task. Alternatively, you can convert your virtual machine to a Shared VM and manage autostart settings from the main Shared VMs window. In VMware Workstation 17 Pro, VMware added the native functionality to autostart virtual machines without the need to use a batch script.
- What should I do if I encounter an autostart bug in VMware ESXi 6.0?
If you encounter a bug in VMware ESXi 6.0 where only the first virtual machine starts automatically despite correct autostart priority configurations, you can resolve the issue by enabling SSH access on the ESXi, connecting to the host using an SSH client, and re-registering the problematic VM on the host using the appropriate vim-cmd commands.
Wrapping up
The process to configure autostart of a VM in VMware ESXi is straightforward and can be done easily using the ESXi host client, as shown in the walkthrough. There are a few things to be considered, especially if you are using the autostart feature to startup virtual machines in the correct order for business-critical applications. You also need to be aware of buggy behavior in old versions of VMware ESXi, including ESXi 6.0.
You can also use the autostart feature in VMware Workstation. Starting in VMware Workstation 17 Pro, the autostart feature is natively built into the console and you no longer need to use a batch file with the vmrun.exe tool. However, for older versions of VMware Workstation, this is still a viable option.