Auto launch – shutdown guest VM’s

Auto launch and shutdown guest within VMware Workstation

I was asked many times for easy way to auto/schedule launch and gracefully shutdown guest operating systems within VMware Workstation.
So I decided to write this article that provides step-by-step instructions on how to automatically launch and/or shut down a guest OS from within the VMware in addition for some tips to automate this process and windows command to run sequential /parallel process.
This article is a simple contribution from me to anyone looking to develop their IT skills.

Method 1:
Create a shortcut using “vmware.exe” and the VM’s “.vmx” file

 
Create a shortcut

For the item location type:
“C:\Program Files (x86)\VMware\VMware Workstation\vmware.exe” -x C:\VPC\Windows2K3\Windows2K3.vmx

Type a name for this shortcut:
example Start

Now double-click on the shortcut and the VM will start

You can Power off. the VM using keyboard shortcuts Ctrl-E

For more options for vmware.exe
Type “wmware.exe /?

Options window will launch

Method 2:
Create a batch files using “vmrun.exe” and the VM’s “.vmx” file

You can launch/shutdown multiple VM’s with on click
Create “startup.bat” and “shutdown.bat” batch files
type
“C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe” -T ws start “C:\VPC\VM01\VM01.vmx”

“C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe” -T ws stop “C:\VPC\VM01\VM01.vmx”

 
You can create a shortcut and change the icon, or create a scheduled task to run the batch files..

there is many options like pause, snapshot ..etc, my advice is to take a look for available options and write your batch file that match your need
For available options type ” vmrun.exe.exe /?”

Note you can create a shortcut to start VM’s as in method 1

Optimization:

In method 2 we have created a batch files that enables us to start/shutdown multiple vm’s with one click.

  • But this vms will start/shutdown sequentially (vm02 will start after VM01 startup complete) that leads to longer time to start/shutdown the VMS
  • All VMS will display in one window. (all VMs are shown inside a single window)
    What if you have a multi monitor system and you want to display each VM on their own window on a different monitor?
    There is a need in some cases to work with two different VMs at the same time. example when you compare application behavior on two different OS

Let’s start optimizing the files to achieve this
After looking to available options for “vmware.exe” and ” vmrun.exe.exe”
I have decided to use “vmware.exe” and ” vmrun.exe.exe” with the “start” command and create two new batch files to achieve requirement mentioned above.

  

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s