The Virtualization Room

Aug 14 2008   11:33AM GMT

Powerful scripting options with the VBoxManage command

Rick Vanover Rick Vanover Profile: Rick Vanover

Sun xVM VirtualBox offers a powerful command-line interface (CLI) component, VBoxManage, which can perform most functions within VirtualBox. Having a robust CLI is key to automation and scripting, even in a workstation virtualization product. In my continued coverage of VirtualBox, this blog will highlight some of the parameters of VBoxManage with some examples and areas where this command can be of use.

Modifyvm parameter
Probably one of the more versatile commands for VBoxManage is modifyvm. This parameter can set memory, operating system type, pae settings, monitor quantity, hardware inventory as well as snapshot configuration. Here is a sample command that sets a memory amount, makes the CD-ROM disk the first boot device and disables USB support:

vboxmanage modifyvm XP-TestSystem -memory 512 -boot1 dvd -usb off

The modifyvm parameter also has extended options such as BIOS display time, network interface driver type, host network interface assigned to the VM and enabling or disabling of the clipboard. Overall, modifyvm has over 50 parameters for an individual VM.

Controlvm parameter
From an automation standpoint, the controlvm parameter would be used to start a VM at host system boot. Controlvm can also be used to attach USB or DVD devices. The entry below will disconnect the media of the two virtual Ethernet adapters and reset the power state:

vboxmanage controlvm XP-TestSystem reset setlinkstate1 off
vboxmanage controlvm XP-TestSystem setlinkstate2 off

Note that in the case of an inventory of multiple devices of the same type, a separate entry would be required as in the case of disabling the network interface.

Snapshot parameter
The snapshot parameter can be used to manage all elements of a snapshot. In the case of a frequently used test system, it may be a good idea to automate the change back to the base snapshot. The following command would revert a VM to the existing snapshot:

vboxmanage snapshot XP-TestSystem discardcurrent -state

This command cannot be executed while the VM is running, yet a leading with a power down controlvm parameter can get the system to a state where running the snapshot parameter will do the trick.

Powerful Stuff
This is a very quick sample of what is capable with the VBoxManage command. I don’t know of anything that can be done in the interface that cannot be done with this command. VBoxManage commands also interact the same way across different platforms of xVM VirtualBox. This flexibility offers a compelling solution for an automated deployable solution at the zero-cost of xVM VirtualBox. The online user manual has the entire chapter 8 dedicated to the VBoxManage command, which can be downloaded from the VirtualBox 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: