How to Automatically Start a Virtual Machine (VM) with Windows startup

Learn how to add a virtual machine to your Windows 10 startup, which is useful for starting your critical services and applications hosted in VMWare Workstation platform.
Shell:Startup method
This method starts VMs AFTER you login to Windows
- Add the following code to a new bat file
auto-start-vm.bat
, and replace VMX file path with the one from the desired VM:
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" start "C:\Users\elastic\Documents\Virtual Machines\Docker\Docker.vmx"
For VMs that don’t need to appear on the screen (Run in the background), just add nogui
as follows:
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" start "C:\Users\elastic\Documents\Virtual Machines\Docker\Docker.vmx" nogui
- Press Windows Key + R to open a location, and enter
shell:startup
. - Copy
auto-start-vm.bat
toshell:startup
Alternative method to placing bat file in shell:startup is to run the bat file using Windows Task Scheduler. This method you edit task properties and allow the command to run regardless if you log in to Windows or not for DNS servers/AD Farms to work immediately on computer startup.
Task scheduler method
With this method you can start VMs BEFORE you login to Windows. This is a popular option for DNS & Active Directory servers to work immediately on computer startup.
- Create the bat file as described above.
- Search Windows for
Task Scheduler
. - In
Task Scheduler
clickCreate Task
. - Choose a name for the task.
- Choose
Run whether user is logged on or not
. - Under
Triggers
tab > add a new trigger >At startup
. - Under
Action
tab > Start a program > browse to yourauto-start-vm.bat
. - Save task.
The task will now run every time you restart your computer and before user logs in.
Window update may break the task during major updates.
When this happen you may open
Task Scheduler
to trigger your task manually, or restart your computer again after completing any Windows update dialogues.