Tips

Run Along, Virtual Doggies

Manipulate how your VMs work using the vmrun command.

Ever wanted to script the start or stop of a virtual machine? How about doing the same, but with a scheduled task?

The vmrun command is another native tool installed with VMware Workstation. This tool provides the following command line options for manipulating the state of virtual machines:

  • List: List all running VM’s
  • Start: Start a VM or Virtual Team
  • Stop: Stop a VM or Virtual Team
  • Reset: Reset a VM or Virtual Team
  • Suspend: Suspend a VM or Virtual Team
  • Upgradevm: Upgrade VM file format
  • Installtools: Install VM Tools inside a Guest OS
  • listSnapshots: List snapshots in a VM
  • snapshot: Create a VM snapshot
  • deleteSnapshot: Remove a VM snapshot
  • revertToSnapshot: Revert the VM state to a snapshot

For most of these options, you’ll also need to list the path to the VMX configuration file for an individual VM or the VMTN configuration file for a VM Team.

Note that the Installtools command has some special behaviors when used on a non-Windows VM. For Windows VMs, Installtools will automatically start the VMware Tools installation process. For Linux VMs, it will only mount the VMware tools CD to the VM. You must then manually install the tools from that mounted ISO.

If you want to fully automate this using scripting or scheduled tasks, you may want to disable any dialog boxes by adding the line msg.autoAnswer=TRUE into the affected VMX configuration files.

About the Author

Greg Shields is Author Evangelist with PluralSight, and is a globally-recognized expert on systems management, virtualization, and cloud technologies. A multiple-year recipient of the Microsoft MVP, VMware vExpert, and Citrix CTP awards, Greg is a contributing editor for Redmond Magazine and Virtualization Review Magazine, and is a frequent speaker at IT conferences worldwide. Reach him on Twitter at @concentratedgreg.

comments powered by Disqus
Most   Popular