VMWare workstation let the virtual machine start automatically with the host

On Windows:

How to autostart a virtual machine in VMware Workstation

 

 

Create a batch file with this line:
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -T ws start E:\VMs\wxp-a\wxp-a.vmx nogui
Replace wxp-a with the name of your virtual machine.
Call this batch from your windows startup menu.

 

On Linux:

Auto-Start Your VMWare Virtual Machines Without the GUI

Posted: 19th January 2011 by Mark in Unix
3

I was looking for a method that allowed me to SSH to my Linux machine running VMWare Workstation 7 and execute a file that automatically starts all my VMWare virtual machines without having to use the GUI.  This could also be used as a startup script as well.

In my case I am running several Cisco Unified Communications servers.  I also have a Windows 2008 VM to integrate LDAP with CUCM. I used vi to create a file called ciscostart.sh and made it executable. By executing this file I am able to start all VM’s without having to use the GUI.

#!/bin/bash
#
#Init file for starting Cisco virtual machines

vmrun start ~/vmware/CUCM_8_PUB/CUCM_8_PUB.vmx nogui
vmrun start ~/vmware/CUCM_8_SUB/CUCM_8_SUB.vmx nogui
vmrun start ~/vmware/UNITY_CONNECTION_8/UNITY_CONNECTION_8.vmx nogui
vmrun start ~/vmware/CUPS_8/CUPS_8.vmx nogui
vmrun start ~/vmware/EMERGENCY_RESPONDER_8/EMERGENCY_RESPONDER_8.vmx nogui
vmrun start ~/vmware/MEETING_PLACE_8/MEETING_PLACE_8.vmx nogui
vmrun start ~/vmware/UCCX8/UCCX8.vmx nogui
vmrun start ~/vmware/Win2008_Server_Primary_AD/Win2008_Server_Primary_AD.vmx nogui

To gracefully stop theese VM’s I created another file called ciscostop.sh and the arguments are very similar.

#!/bin/bash
#
#Init file for stopping Cisco virtual machines

vmrun stop ~/vmware/CUCM_8_PUB/CUCM_8_PUB.vmx soft
vmrun stop ~/vmware/CUCM_8_SUB/CUCM_8_SUB.vmx soft
vmrun stop ~/vmware/UNITY_CONNECTION_8/UNITY_CONNECTION_8.vmx soft
vmrun stop ~/vmware/CUPS_8/CUPS_8.vmx soft
vmrun stop ~/vmware/EMERGENCY_RESPONDER_8/EMERGENCY_RESPONDER_8.vmx soft
vmrun stop ~/vmware/MEETING_PLACE_8/MEETING_PLACE_8.vmx soft
vmrun stop ~/vmware/UCCX8/UCCX8.vmx soft
vmrun stop ~/vmware/Win2008_Server_Primary_AD/Win2008_Server_Primary_AD.vmx soft

 

With the Linux version of VMWare you can execute vmware instead of vmrun and it launches a new instance of vmware with the specific guest OS you specify. In fact, this was the default behavior and I wrote this blog post to work around that. I do not run vmware on Windows but I would like to think the same is achievable. You could most likely make a .BAT script that launches vmware from a DOS prompt and loads the vmware guest OS you want. Create a .BAT for each VM or maybe try combining all the commands into one .BAT if you always want to launch the same guests each time.

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327039193&siteId=291194637