Enable Virtual Machine AutoStart on VMware Workstation

PowerADM.com / Virtualization / VMware / Enable Virtual Machine AutoStart on VMware Workstation

VMware Workstation and VMware Player do not have a built-in option to automatically start virtual machines when Windows boots up or when a user logs in. If you want the VM to start automatically, you must create an automated task in the Scheduler.

How to Start VMware Workstation/Player VM Using the Task Scheduler?

You can use the vmrun.exe command-line utility to automatically start virtual machines. It is located in the following directory:

  • VMware Workstation: "C:\Program Files (x86)\VMware\VMware Workstation”
  • VMware Player: "C:\Program Files (x86)\VMware\VMware Player\vmrun.exe"

To start a VM from the command line, you must specify the full path to its VMX configuration file. For example

"C:\Program Files (x86)\VMware\VMware Player\vmrun.exe" start "G:\VM\ubuntu1\ubntu1.vmx"

us vmrun.exe command to start VMware VM

Using the gui|nogui options, you can run the VM in a separate window or in the background.

Now let’s configure the automatic task scheduler. Open the Windows Task Scheduler console (taskschd.msc):

  1. Select Action -> Create Basic Task;
  2. Specify the task name;
  3. On the Trigger tab, select When the computer starts;
  4. Action -> Start a program;
  5. Paste the full path to vmrun.exe into the Program/Script field: "C:\Program Files (x86)\VMware\VMware Player\vmrun.exe"
  6. Add the arguments: start "G:\VM\ubuntu1\ubntu1.vmxAutostart VMware VM via sheduled task
  7. This VM will start automatically when Windows boost.
If you want to start an encrypted VM, you can specify its password using the option: -vp encryptionpasssword.

If you need to start multiple VMs in sequence, create a StartVMs.bat file with the order in which the VMs will be started and run it through the Task Scheduler:

@echo off
timeout /t 5
"C:\Program Files (x86)\VMware\VMware Player\vmrun.exe" start "G:\VM\DC1\DC1.vmx" nogui
timeout /t 20
"C:\Program Files (x86)\VMware\VMware Player\vmrun.exe" start "G:\VM\ubuntu1\ubntu1.vmx" nogui
timeout /t 20
REM Lock Windiws desktop
rundll32.exe user32.dll,LockWorkStation

You can also use the vmware.exe file to start the VM. For example, the following command will start the virtual machine and expand its console to the full screen:

“C:\Program Files(x86)\VMware\VMware Workstation\vmware.exe” -X "G:\VM\ubuntu1\ubntu1.vmx"

Configuring Virtual Machine Autostart in VMware Workstation Pro

VMware Workstation Pro 17.0 introduced the option to autostart a VM. When you install this version of VMware Workstation, you will see a new VMware Startup Service appear in Windows.

Set this service to start automatically:

Set-Service VMwareAutostartService –startuptype automatic –passthru

VMware Startup Service in Windows

Then open the VMware Workstation console and navigate to View -> Customize -> Library -> My computer -> Configure Auto Start VMs.

VMware Workstation Pro - Configure Auto Start VMs

Select the virtual machines you want to start automatically when the host OS starts up.

You cannot enable autorun for encrypted VMs (for example, if you are using a virtual TPM).

In some cases, an error may occur during configuration:

Failed to update AutoStart configuration. Ensure that the vmAutoStart.xml file exists and you have permissions to write this file.

If you start the VMwareAutostartService service under a specific user account (configured in the Logon tab of the service properties), verify that this user has write permissions to the %ALLUSERSPROFILE%\VMware\VMware Workstation\vmAutoStart.xml file.

Leave a Reply

Your email address will not be published. Required fields are marked *