Virtualization Pro

Oct 17 2008   1:49PM GMT

Starting a VMware Server virtual machine with vmrun

Rick Vanover Rick Vanover Profile: Rick Vanover

Having a virtual machine or series of virtual machines start up from a script or remote command can be a time saver, especially when compared with logging into the Web interface. VMware Server 2 and prior versions offer the vmrun command for six major tasks that you can perform on a virtual machine: starting, stopping, resetting, pausing, unpausing and suspending. Let’s run through an example that I recently saved as scripts on my VMware Server 2 (build 116503) installed on a Linux server.

The following command will start the virtual machine named ScriptStart1:

vmrun -T server -h https://dhcp-122:8333/sdk -u root -p rootpass start "[standard] ScripitStartVM1/ScriptStartVM1.vmx"

Once that command is launched, the receipt of this command is represented in the scrolling log accessible through VMware Server Web Access. This is shown in the figure below:

Command visible in the scrolling log of VMware Infrastructure Web Access

One important note that in this example the command is case sensitive to the datastore path, so the VM name of ScriptStart1 cannot be represented any way other than its location in the datastore. The path and .vmx file name may vary in situations where the VM has undergone name changes or copy operations from another VM.

There are quite a lot of parameters passed to the VMware server with the vmrun command, and it is important to note a few attributes of the command. The parameters are designated below:

  • T – VMware platform, server is the designation for VMware Server
  • h – This URL is the host system. Note the port assignment will be set during installation. This example was a default configuration
  • u -p – username and password sent to the host
  • start – the command sent to the host

The last parameter is the path to the virtual machine within the datastore.

Aside from this quick example of a basic start command, vmrun has many other features, such as installing VMware Tools, adding shared folders, killing a process in a guest VM and reverting to a snapshot. One positive point about vmrun is that it can be used in both VMware Server (versions 1 and 2) and VMware Workstation products. There is a lot more to vmrun, and the full command documentation can be found in the vmrun control document available on the VMware website.

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: