December 31, 2008 · Networking · Email This Post

Sponsored Link
VBoxManage, a command-line utility that allows you to control all of VirtualBox's powerful features.In essence, VBoxManage supports everything that our graphical user interface allows you to do with the click of a button. VBoxManage supports a lot more than that,however. It exposes really all the features of the virtualization engine, even those that cannot (yet) be accessed from the GUI.

There are two main things to keep in mind when using VBoxManage

  • First,VBoxManage must always be used with a specific “subcommand”, such as “list vms” or “createvm” or “startvm”.
  • Second, most of these subcommands require that you specify a particular virtual machine after the subcommand. There are two ways you can do this:

You can specify the VM name, as it is shown in the VirtualBox GUI. Note that if that name contains spaces, then you must enclose the entire name in double quotes (as it is always required with command line arguments that contain spaces).

Example

VBoxManage startvm "Windows XP"

You can specify the UUID, which is the internal unique identifier that VirtualBox uses to refer to the virtual machine. Assuming that the aforementioned VM called “Windows XP” has the UUID shown below, the following command has the same effect as the previous:

VBoxManage startvm 670e746d-abea-4ba6-ad02-2a3b043810a5

You can type VBoxManage list vms to have all currently registered VMs listed with all their settings, including their respective names and UUIDs.

Create a new virtual machine using VBoxManage

To create a new virtual machine from the command line and immediately register it with VirtualBox, use VBoxManage createvm with the -register option.

Example

VBoxManage createvm -name "SUSE 10.2″ -register

VirtualBox Command Line Management Interface Version 2.1.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
Virtual machine ’SUSE 10.2’ is created.
UUID: c89fc351-8ec6-4f02-a048-57f4d25288e5
Settings file: ’/home/username/.VirtualBox/Machines/SUSE 10.2/SUSE 10.2.xml’

As can be seen from the above output, a new virtual machine has been created with a new UUID and a new XML settings file.

Show configuration of a particular VM

The showvminfo command shows information about a particular virtual machine.This is the same information as VBoxManage list vms would show for all virtual machines.

VBoxManage showvminfo "Windows XP"

You will get information similar to the following:

VirtualBox Command Line Management Interface Version 2.1.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.
Name: Windows XP
Guest OS: Other/Unknown
UUID: 1bf3464d-57c6-4d49-92a9-a5cc3816b7e7
Config file: /home/username/.VirtualBox/Machines/Windows XP/Windows XP.xml
Memory size: 128MB
VRAM size: 8MB
Boot menu mode: message and menu
ACPI: on
IOAPIC: off
Hardw. virt.ext: off
State: powered off
Floppy: empty
DVD: empty
NIC 1: disabled
NIC 2: disabled
NIC 3: disabled
NIC 4: disabled
Audio: disabled (Driver: Unknown)
VRDP: disabled
USB: disabled
USB Device Filters:
<none>

How to Change Virtual Machine Settings

VBoxManage modifyvm this command changes the properties of a registered virtual machine. Most of the properties that this command makes available correspond to the VM settings that VirtualBox graphical user interface displays in each VM’s “Settings” dialog.

Changing memory settings using the folowing command

VBoxManage modifyvm "Windows XP" -memory "512MB"

One more example to 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.

If you want more options check virtualbox usermanual

How to start virtual machine from command line

VBoxManage startvm This command starts a virtual machine that is currently in the “Powered off” or “Saved” states. This is provided for backwards compatibility only.The optional -type specifier determines whether the machine will be started in a
window (GUI mode, which is the default) or whether the output should go through VBoxHeadless, the VRDP-only server.

This is a very quick sample of what is capable with the VBoxManage command.

Sponsored Link

Incoming search terms:

Related posts

8 Comments to “How to control virtual machines (Virtualbox) using VBoxManage”

  1. Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader.

    [Reply]

  2. surbhi says:

    how to log on to the the host machine using commandline?

    [Reply]

  3. Cody Cooper says:

    Thank You so much for your awesome post on VirtualBox, I’m not looking at releasing some VPS software soon using VirtualBox as the core !!!!

    [Reply]

  4. @surbhi says:

    how to log on to the the host machine using commandline?

    rdesktop server:rdp

    [Reply]

  5. Scott David Daniels says:

    You might want to change your examples:

    VBoxManage modifyvm “DataBase1” -memory “512MB”

    does not work for me.

    However,

    VBoxManage modifyvm “DataBase1” -memory 512

    _does_ work for me.

    -Scott

    [Reply]

  6. TonWillems says:

    ton@de2willempjes:~$ vboxmanage modifyhd “/home/ton/VirtualBox VMs/XP-SP3slip/XP-SP3slip.vdi” –resize 21000
    0%…10%…20%…30%…40%…50%…60%…70%…80%…90%…100%

    Worked for me, thanks to you- all.
    Ton.

    [Reply]

  7. chinna says:

    how to access shared windows file from virtual box or fedora ??? i changed netwrok connection to “bridge adapter”

    [Reply]

  8. Tonté says:

    After the virtual machine is started in headless mode, is there a command to start up IE that points to a specific URL?

    I am looking to point IE to a localhost URL that points back to a server on my mac. Is this possible?

    Thank you.

    [Reply]

Leave a Reply