vmware

Configure Autostart of VM on VMware ESXi


By default, virtual machines located on VMWare ESXi (Free Hypervisor) or VMWare Workstation is not starting automatically at the host boot. This means that after the ESXi/ Workstation host reboot (planned restart or crash, for example, caused by a power failure), Administrator have to manually start all the virtual machines. In this guide we will show you how to configure Autostart VM on the ESXi and VMWare Workstation host without Administrator intervention.

How to Configure VM Autostart on VMware ESXi?

At first, open browser and go to the login screen page of the VMware Web Client and then log on. In Web Client console, select ESXi host which you want to configure for VMs autostart. Then go to following tab Manage > Settings > VM Startup/Shutdown.

Tip. If your ESXI host is a part of vSphere HA cluster, you can’t configure VM autostart and shutdown settings this way, because HA cluster respond for the availability of VM.

As you can see all of the virtual machines disposed on a given ESXi host are in Manual Startup section. This means that after host rebooting they will have to be started manually.

In order to be booted automatically you need to add VMs manually to the Automatic Startup list.

Click the Edit button.

esxi autostart vm

In the dialog Edit VM Startup and Shutdown check on Allow virtual machine to start and stop automatically with the system. It is now possible to configure the auto start settings for VMs.

There are common options of startup and shutdown behavior:

  • Startup delay — How many seconds VMs wait before powering on (by default 120 seconds). This delay allows you to wait for booting of custom services and scripts execution;
  • Shutdown delay — Specifies the time delay before shutdown each virtual machine (by default 120 seconds);
  • Shutdown Action — for each VM available 4 shutdown actions: None, Power Off , Suspend or Guest Shutdown (using opportunities of VMware Tools, that you need to pre-install in the guest operating system). Вy default used action is Power Off.

esxi auto start vm

You can place VM to the one of the following sections:

  • Automatic Startup — all virtual machines in this section are starting automatically after the completion of the ESXi host boot. Administrator specifies a specific boot sequence of virtual machines. For example, domain controller should be booted first, then Exchange servers etc;
  • Any Order — VMs powering on automatically in random order;
  • Manual Startup — Administrator should start these VMs manually.

Select desired virtual machine and use Move up button to move it to Automatic Startup section. Similar action is performed with all the VMs on the ESXi host.

Click OK to save your changes and close the dialog box.

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

In addition, you can configure autostart 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.

In VMWare ESXi 6.0, there was a strange bug. Despite the fact that the autostart priority for virtual machines was configured, after the host server was rebooted, only the first virtual machine was automatically started. The second virtual machine stubbornly refuses to boot.


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 autostart 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 problem 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 that 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 which is located in the folder with the installed Workstation.

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) or added to the Windows Startup or run by 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 Configure AutoStart window that opens, 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).

You may also like:

VMware ESXi: Shared Disk Between VMs In some cases (as a rule in clustering scenarios) it may be necessary to share the same disk (vmdk or RMD) between 2 (or more) virtual machines (VMs) ...
Time Configuration for a Virtualized Domain Contro... Today we will talk about some of the features of time configuration on a virtualized domain controllers. Typically, the time synchronization scheme in...
How to Mount Windows Folder into VMware ESXi In this article we will take a look on how to connect a network folder from Windows 2012 R2 Server as a datastore on the VMware ESXi host and use it t...
How to Install Windows 10 on VMWare ESXi 6.0 This installation guide will explain each phase step by step and guide you through Windows 10 operating system installation on a virtual machine (VM) ...
How to fix VMWare ESXi 5.5 Upgrade error Hey guys. Today we will show you how to fix VMWare ESXi 5.5 Upgrade error. If you are trying to upgrade your VmWare ESXi to 5.5 U2d version, you might...
Comments
  1. Posted by Komrad
    • Posted by TheITBros
  2. Posted by Andy
    • Posted by The IT Bros
      • Posted by Alex Stumpf

Add Your Comment