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"
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
):
- Select Action -> Create Basic Task;
- Specify the task name;
- On the Trigger tab, select When the computer starts;
- Action -> Start a program;
- Paste the full path to vmrun.exe into the Program/Script field:
"C:\Program Files (x86)\VMware\VMware Player\vmrun.exe"
- Add the arguments:
start "G:\VM\ubuntu1\ubntu1.vmx
” - This VM will start automatically when Windows boost.
-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
Then open the VMware Workstation console and navigate to View -> Customize -> Library -> My computer -> Configure Auto Start VMs.
Select the virtual machines you want to start automatically when the host OS starts up.
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.