Gerenciando o Virtual box

Introduction

Introduction

As briefly mentioned in the section called “Alternative front-ends”, VBoxManage is
the command-line interface to VirtualBox. With it, you can completely
control VirtualBox from the command line of your host operating system.
VBoxManage supports all the features that the graphical user interface
gives you access to, but it supports a lot more than that. It exposes
really all the features of the virtualization engine, even those that
cannot (yet) be accessed from the GUI.

You will need to use the command line if you want to

  • use a different user interface than the main GUI (for example,
    VBoxSDL or the VBoxHeadless server);
  • control some of the more advanced and experimental
    configuration settings for a VM.

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” or “createvm” or “startvm”. All the
subcommands that VBoxManage supports are
described in detail in Chapter 8, VBoxManage.

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).For 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.

Some typical examples of how to control VirtualBox from the command
line are listed below:

  • To create a new virtual machine from the command line and
    immediately register it with VirtualBox, use
    VBoxManage createvm with the
    --register option,[35]like this:

    $ VBoxManage createvm --name "SUSE 10.2" --register
    VirtualBox Command Line Management Interface Version 4.1.14
    (C) 2005-2012 Oracle Corporation
    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.

  • To show the configuration of a particular VM, use
    VBoxManage showvminfo; see the section called “VBoxManage showvminfo” for details and an example.
  • To change settings while a VM is powered off, use
    VBoxManage modifyvm, e.g. as
    follows:

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

    For details, see the section called “VBoxManage modifyvm”.

  • To change the storage configuration (e.g. to add a storage
    controller and then a virtual disk), use VBoxManage
    storagectl
    and VBoxManage
    storageattach
    ; see the section called “VBoxManage storagectl” and the section called “VBoxManage storageattach” for details.
  • To control VM operation, use one of the following:

Commands overview

When running VBoxManage without parameters or when supplying an
invalid command line, the below syntax diagram will be shown. Note that
the output will be slightly different depending on the host platform; when
in doubt, check the output of VBoxManage
for the commands available on your particular host.

Usage:

VBoxManage [-v|--version]    print version number and exit
VBoxManage [-q|--nologo] ... suppress the logo

VBoxManage list [--long|-l] vms|runningvms|ostypes|hostdvds|hostfloppies|
                            bridgedifs|dhcpservers|hostinfo|
                            hostcpuids|hddbackends|hdds|dvds|floppies|
                            usbhost|usbfilters|systemproperties|extpacks

VBoxManage showvminfo       <uuid>|<name> [--details]
                            [--machinereadable]
VBoxManage showvminfo       <uuid>|<name> --log <idx>

VBoxManage registervm       <filename>

VBoxManage unregistervm     <uuid>|<name> [--delete]

VBoxManage createvm         --name <name>
                            [--ostype <ostype>]
                            [--register]
                            [--basefolder <path>]
                            [--uuid <uuid>]

VBoxManage modifyvm         <uuid|name>
                            [--name <name>]
                            [--ostype <ostype>]
                            [--memory <memorysize in MB>]
                            [--pagefusion on|off]
                            [--vram <vramsize in MB>]
                            [--acpi on|off]
                            [--ioapic on|off]
                            [--pae on|off]
                            [--hpet on|off]
                            [--hwvirtex on|off]
                            [--hwvirtexexcl on|off]
                            [--nestedpaging on|off]
                            [--largepages on|off]
                            [--vtxvpid on|off]
                            [--synthcpu on|off]
                            [--cpuidset <leaf> <eax> <ebx> <ecx> <edx>]
                            [--cpuidremove <leaf>]
                            [--cpuidremoveall]
                            [--hardwareuuid <uuid>]
                            [--cpus <number>]
                            [--cpuhotplug on|off]
                            [--plugcpu <id>]
                            [--unplugcpu <id>]
                            [--cpuexecutioncap <1-100>]
                            [--rtcuseutc on|off]
                            [--monitorcount <number>]
                            [--accelerate3d on|off]
                            [--firmware bios|efi|efi32|efi64]
                            [--chipset ich9|piix3]
                            [--bioslogofadein on|off]
                            [--bioslogofadeout on|off]
                            [--bioslogodisplaytime <msec>]
                            [--bioslogoimagepath <imagepath>]
                            [--biosbootmenu disabled|menuonly|messageandmenu]
                            [--biossystemtimeoffset <msec>]
                            [--biospxedebug on|off]
                            [--boot<1-4> none|floppy|dvd|disk|net>]
                            [--nic<1-N> none|null|nat|bridged|intnet|
                                        generic]
                            [--nictype<1-N> Am79C970A|Am79C973]
                            [--cableconnected<1-N> on|off]
                            [--nictrace<1-N> on|off]
                            [--nictracefile<1-N> <filename>]
                            [--nicproperty<1-N> name=[value]]
                            [--nicspeed<1-N> <kbps>]
                            [--nicbootprio<1-N> <priority>]
                            [--nicpromisc<1-N> deny|allow-vms|allow-all]
                            [--nicbandwidthgroup<1-N> none|<name>]
                            [--bridgeadapter<1-N> none|<devicename>]
                            [--intnet<1-N> <network name>]
                            [--natnet<1-N> <network>|default]
                            [--nicgenericdrv<1-N> <driver>
                            [--natsettings<1-N> [<mtu>],[<socksnd>],
                                                [<sockrcv>],[<tcpsnd>],
                                                [<tcprcv>]]
                            [--natpf<1-N> [<rulename>],tcp|udp,[<hostip>],
                                          <hostport>,[<guestip>],<guestport>]
                            [--natpf<1-N> delete <rulename>]
                            [--nattftpprefix<1-N> <prefix>]
                            [--nattftpfile<1-N> <file>]
                            [--nattftpserver<1-N> <ip>]
                            [--natbindip<1-N> <ip>
                            [--natdnspassdomain<1-N> on|off]
                            [--natdnsproxy<1-N> on|off]
                            [--natdnshostresolver<1-N> on|off]
                            [--nataliasmode<1-N> default|[log],[proxyonly],
                                                         [sameports]]
                            [--macaddress<1-N> auto|<mac>]
                            [--mouse ps2|usb|usbtablet
                            [--keyboard ps2|usb
                            [--uart<1-N> off|<I/O base> <IRQ>]
                            [--uartmode<1-N> disconnected|
                                             server <pipe>|
                                             client <pipe>|
                                             file <file>|
                                             <devicename>]
                            [--guestmemoryballoon <balloonsize in MB>]
                            [--gueststatisticsinterval <seconds>]
                            [--audio none|null|dsound|solaudio|oss|
                                     oss|coreaudio]
                            [--audiocontroller ac97|hda|sb16]
                            [--clipboard disabled|hosttoguest|guesttohost|
                                         bidirectional]
                            [--vrde on|off]
                            [--vrdeextpack default|<name>
                            [--vrdeproperty <name=[value]>]
                            [--vrdeport <hostport>]
                            [--vrdeaddress <hostip>]
                            [--vrdeauthtype null|external|guest]
                            [--vrdeauthlibrary default|<name>
                            [--vrdemulticon on|off]
                            [--vrdereusecon on|off]
                            [--vrdevideochannel on|off]
                            [--vrdevideochannelquality <percent>]
                            [--usb on|off]
                            [--usbehci on|off]
                            [--snapshotfolder default|<path>]
                            [--teleporter on|off]
                            [--teleporterport <port>]
                            [--teleporteraddress <address|empty>
                            [--teleporterpassword <password>]
                            [--teleporterpasswordfile  <file>|stdin]

VBoxManage clonevm          <uuid>|<name>
                            [--snapshot <uuid>|<name>]
                            [--mode machine|machineandchildren|all]
                            [--options link|keepallmacs|keepnatmacs|
                                       keepdisknames]
                            [--name <name>]
                            [--basefolder <basefolder>]
                            [--uuid <uuid>]
                            [--register]

VBoxManage import           <ovf/ova>
                            [--dry-run|-n]
                            [--options keepallmacs|keepnatmacs]
                            [more options]
                            (run with -n to have options displayed
                             for a particular OVF)

VBoxManage export           <machines> --output|-o <ovf/ova>
                            [--legacy09]
                            [--manifest]
                            [--vsys <number of virtual system>]
                                    [--product <product name>]
                                    [--producturl <product url>]
                                    [--vendor <vendor name>]
                                    [--vendorurl <vendor url>]
                                    [--version <version info>]
                                    [--eula <license text>]
                                    [--eulafile <filename>]

VBoxManage startvm          <uuid>|<name>...
                            [--type gui|sdl|headless]

VBoxManage controlvm        <uuid>|<name>
                            pause|resume|reset|poweroff|savestate|
                            acpipowerbutton|acpisleepbutton|
                            keyboardputscancode <hex> [<hex> ...]|
                            setlinkstate<1-N> on|off |
                            nic<1-N> null|nat|bridged|intnet|generic
                                     [<devicename>] |
                            nictrace<1-N> on|off
                            nictracefile<1-N> <filename>
                            nicproperty<1-N> name=[value]
                            natpf<1-N> [<rulename>],tcp|udp,[<hostip>],
                                          <hostport>,[<guestip>],<guestport>
                            natpf<1-N> delete <rulename>
                            guestmemoryballoon <balloonsize in MB>]
                            gueststatisticsinterval <seconds>]
                            usbattach <uuid>|<address> |
                            usbdetach <uuid>|<address> |
                            vrde on|off |
                            vrdeport <port> |
                            vrdeproperty <name=[value]> |
                            vrdevideochannelquality <percent>
                            setvideomodehint <xres> <yres> <bpp> [display] |
                            screenshotpng <file> [display] |
                            setcredentials <username> <password> <domain>
                                           [--allowlocallogon <yes|no>] |
                            teleport --host <name> --port <port>
                                   [--maxdowntime <msec>] [--password password]
                            plugcpu <id>
                            unplugcpu <id>
                            cpuexecutioncap <1-100>

VBoxManage discardstate     <uuid>|<name>

VBoxManage adoptstate       <uuid>|<name> <state_file>

VBoxManage snapshot         <uuid>|<name>
                            take <name> [--description <desc>] [--pause] |
                            delete <uuid>|<name> |
                            restore <uuid>|<name> |
                            restorecurrent |
                            edit <uuid>|<name>|--current
                                 [--name <name>]
                                 [--description <desc>] |
                            list [--details|--machinereadable]
                            showvminfo <uuid>|<name>

VBoxManage closemedium      disk|dvd|floppy <uuid>|<filename>
                            [--delete]

VBoxManage storageattach    <uuid|vmname>
                            --storagectl <name>
                            [--port <number>]
                            [--device <number>]
                            [--type dvddrive|hdd|fdd]
                            [--medium none|emptydrive|
                                      <uuid>|<filename>|host:<drive>|iscsi]
                            [--mtype normal|writethrough|immutable|shareable|
                                     readonly|multiattach]
                            [--comment <text>]
                            [--setuuid <uuid>]
                            [--setparentuuid <uuid>]
                            [--passthrough on|off]
                            [--tempeject on|off]
                            [--nonrotational on|off]
                            [--bandwidthgroup <name>]
                            [--forceunmount]
                            [--server <name>|<ip>]
                            [--target <target>]
                            [--tport <port>]
                            [--lun <lun>]
                            [--encodedlun <lun>]
                            [--username <username>]
                            [--password <password>]
                            [--intnet]

VBoxManage storagectl       <uuid|vmname>
                            --name <name>
                            [--add ide|sata|scsi|floppy|sas]
                            [--controller LSILogic|LSILogicSAS|BusLogic|
                                          IntelAHCI|PIIX3|PIIX4|ICH6|I82078]
                            [--sataideemulation<1-4> <1-30>]
                            [--sataportcount <1-30>]
                            [--hostiocache on|off]
                            [--bootable on|off]
                            [--remove]

VBoxManage bandwidthctl     <uuid|vmname>
                            --name <name>
                            [--add disk|network]
                            [--limit <megabytes per second>
                            [--delete]

VBoxManage showhdinfo       <uuid>|<filename>

VBoxManage createhd         --filename <filename>
                            --size <megabytes>|--sizebyte <bytes>
                            [--format VDI|VMDK|VHD] (default: VDI)
                            [--variant Standard,Fixed,Split2G,Stream,ESX]

VBoxManage modifyhd         <uuid>|<filename>
                            [--type normal|writethrough|immutable|shareable|
                                    readonly|multiattach]
                            [--autoreset on|off]
                            [--compact]
                            [--resize <megabytes>|--resizebyte <bytes>]

VBoxManage clonehd          <uuid>|<filename> <uuid>|<outputfile>
                            [--format VDI|VMDK|VHD|RAW|<other>]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--existing]

VBoxManage convertfromraw   <filename> <outputfile>
                            [--format VDI|VMDK|VHD]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--uuid <uuid>
VBoxManage convertfromraw   stdin <outputfile> <bytes>
                            [--format VDI|VMDK|VHD]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--uuid <uuid>

VBoxManage getextradata     global|<uuid>|<name>
                            <key>|enumerate

VBoxManage setextradata     global|<uuid>|<name>
                            <key>
                            [<value>] (no value deletes key)

VBoxManage setproperty      machinefolder default|<folder> |
                            vrdeauthlibrary default|<library> |
                            websrvauthlibrary default|null|<library> |
                            vrdeextpack null|<library> |
                            loghistorycount <value>

VBoxManage usbfilter        add <index,0-N>
                            --target <uuid>|<name>|global
                            --name <string>
                            --action ignore|hold (global filters only)
                            [--active yes|no] (yes)
                            [--vendorid <XXXX>] (null)
                            [--productid <XXXX>] (null)
                            [--revision <IIFF>] (null)
                            [--manufacturer <string>] (null)
                            [--product <string>] (null)
                            [--remote yes|no] (null, VM filters only)
                            [--serialnumber <string>] (null)
                            [--maskedinterfaces <XXXXXXXX>]

VBoxManage usbfilter        modify <index,0-N>
                            --target <uuid>|<name>|global
                            [--name <string>]
                            [--action ignore|hold] (global filters only)
                            [--active yes|no]
                            [--vendorid <XXXX>|""]
                            [--productid <XXXX>|""]
                            [--revision <IIFF>|""]
                            [--manufacturer <string>|""]
                            [--product <string>|""]
                            [--remote yes|no] (null, VM filters only)
                            [--serialnumber <string>|""]
                            [--maskedinterfaces <XXXXXXXX>]

VBoxManage usbfilter        remove <index,0-N>
                            --target <uuid>|<name>|global

VBoxManage sharedfolder     add <vmname>|<uuid>
                            --name <name> --hostpath <hostpath>
                            [--transient] [--readonly] [--automount]

VBoxManage sharedfolder     remove <vmname>|<uuid>
                            --name <name> [--transient]

VBoxManage debugvm          <uuid>|<name>
                            dumpguestcore --filename <name> |
                            info <item> [args] |
                            injectnmi |
                            log [--release|--debug] <settings> ...|
                            logdest [--release|--debug] <settings> ...|
                            logflags [--release|--debug] <settings> ...|
                            osdetect |
                            osinfo |
                            getregisters [--cpu <id>] <reg>|all ... |
                            setregisters [--cpu <id>] <reg>=<value> ... |
                            statistics [--reset] [--pattern <pattern>]
                            [--descriptions]

VBoxManage metrics          list [*|host|<vmname> [<metric_list>]]
                                                 (comma-separated)

VBoxManage metrics          setup
                            [--period <seconds>] (default: 1)
                            [--samples <count>] (default: 1)
                            [--list]
                            [*|host|<vmname> [<metric_list>]]

VBoxManage metrics          query [*|host|<vmname> [<metric_list>]]

VBoxManage metrics          enable
                            [--list]
                            [*|host|<vmname> [<metric_list>]]

VBoxManage metrics          disable
                            [--list]
                            [*|host|<vmname> [<metric_list>]]

VBoxManage metrics          collect
                            [--period <seconds>] (default: 1)
                            [--samples <count>] (default: 1)
                            [--list]
                            [--detach]
                            [*|host|<vmname> [<metric_list>]]

VBoxManage dhcpserver       add|modify --netname <network_name> |
                            [--ip <ip_address>
                            --netmask <network_mask>
                            --lowerip <lower_ip>
                            --upperip <upper_ip>]
                            [--enable | --disable]

VBoxManage dhcpserver       remove --netname <network_name> |

VBoxManage extpack          install [--replace] <tarball> |
                            uninstall [--force] <name> |
                            cleanup

Each time VBoxManage is invoked, only one command can be executed.
However, a command might support several subcommands which then can be
invoked in one single call. The following sections provide detailed
reference information on the different commands.

VBoxManage list

The list command gives relevant
information about your system and information about VirtualBox’s current
settings.

The following subcommands are available with
VBoxManage list:

  • vms lists all virtual
    machines currently registered with VirtualBox. By default this
    displays a compact list with each VM’s name and UUID; if you also
    specify --long or
    -l, this will be a detailed list as
    with the showvminfo command (see
    below).
  • runningvms lists all
    currently running virtual machines by their unique identifiers
    (UUIDs) in the same format as with
    vms.
  • ostypes lists all guest
    operating systems presently known to VirtualBox, along with the
    identifiers used to refer to them with the
    modifyvm command.
  • hostdvds,
    hostfloppies, respectively, list
    DVD, floppy, bridged networking and host-only networking interfaces
    on the host, along with the name used to access them from within
    VirtualBox.
  • bridgedifs,
    hostonlyifs and
    dhcpservers, respectively, list
    bridged network interfaces, host-only network interfaces and DHCP
    servers currently available on the host. Please see Chapter 6, Virtual networking for details on these.
  • hostinfo displays information
    about the host system, such as CPUs, memory size and operating
    system version.
  • hostcpuids dumps the CPUID
    parameters for the host CPUs. This can be used for a more fine
    grained analyis of the host’s virtualization capabilities.
  • hddbackends lists all known
    virtual disk back-ends of VirtualBox. For each such format (such as
    VDI, VMDK or RAW), this lists the back-end’s capabilities and
    configuration.
  • hdds,
    dvds and
    floppies all give you information
    about virtual disk images currently in use by VirtualBox, including
    all their settings, the unique identifiers (UUIDs) associated with
    them by VirtualBox and all files associated with them. This is the
    command-line equivalent of the Virtual Media Manager; see the section called “The Virtual Media Manager”.
  • usbhost supplies information
    about USB devices attached to the host, notably information useful
    for constructing USB filters and whether they are currently in use
    by the host.
  • usbfilters lists all global
    USB filters registered with VirtualBox — that is, filters for
    devices which are accessible to all virtual machines — and displays
    the filter parameters.
  • systemproperties displays
    some global VirtualBox settings, such as minimum and maximum guest
    RAM and virtual hard disk size, folder settings and the current
    authentication library in use.
  • extpacks displays all
    VirtualBox extension packs currently installed; see the section called “Installing VirtualBox and extension packs” and the section called “VBoxManage extpack” for more information.

VBoxManage showvminfo

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

You will get information similar to the following:

$ VBoxManage showvminfo "Windows XP"
VirtualBox Command Line Management Interface Version 4.1.14
(C) 2005-2012 Oracle Corporation
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:     512MB
VRAM size:       12MB
Number of CPUs:  2
Synthetic Cpu:   off
Boot menu mode:  message and menu
Boot Device (1): DVD
Boot Device (2): HardDisk
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
PAE:             on
Time offset:     0 ms
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging:   on
VT-x VPID:       off
State:           powered off (since 2009-10-20T14:52:19.000000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Storage Controller      (0): IDE Controller
Storage Controller Type (0): PIIX4
Storage Controller      (1): Floppy Controller 1
Storage Controller Type (1): I82078
IDE Controller (0, 0): /home/user/windows.vdi (UUID: 46f6e53a-4557-460a-9b95-68b0f17d744b)
IDE Controller (0, 1): /home/user/openbsd-cd46.iso (UUID: 4335e162-59d3-4512-91d5-b63e94eebe0b)
Floppy Controller 1 (0, 0): /home/user/floppy.img (UUID: 62ac6ccb-df36-42f2-972e-22f836368137)
NIC 1:           disabled
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
UART 1:          disabled
UART 2:          disabled
Audio:           disabled (Driver: Unknown)
Clipboard Mode:  Bidirectional
VRDE:            disabled
USB:             disabled

USB Device Filters:
<none>

Shared folders:
<none>

Statistics update:  disabled

VBoxManage registervm / unregistervm

The registervm command allows you
to import a virtual machine definition in an XML file into VirtualBox. The
machine must not conflict with one already registered in VirtualBox and it
may not have any hard or removable disks attached. It is advisable to
place the definition file in the machines folder before registering
it.

Note

When creating a new virtual machine with
VBoxManage createvm (see below), you
can directly specify the --register
option to avoid having to register it separately.

The unregistervm command
unregisters a virtual machine. If
--delete is also specified, the following
files will automatically be deleted as well:

  1. all hard disk image files, including differencing files, which
    are used by the machine and not shared with other machines;
  2. saved state files that the machine created, if any (one if the
    machine was in “saved” state and one for each online
    snapshot);
  3. the machine XML file and its backups;
  4. the machine log files, if any;
  5. the machine directory, if it is empty after having deleted all
    the above.

VBoxManage createvm

This command creates a new XML virtual machine definition
file.

The --name <name> parameter
is required and must specify the name of the machine. Since this name is
used by default as the file name of the settings file (with the extension
.xml) and the machine folder (a subfolder
of the .VirtualBox/Machines folder), it
must conform to your host operating system’s requirements for file name
specifications. If the VM is later renamed, the file and folder names will
change automatically.

However, if the --basefolder
<path>
option is used, the machine folder will be
named <path>. In this case, the
names of the file and the folder will not change if the virtual machine is
renamed.

By default, this command only creates the XML file without
automatically registering the VM with your VirtualBox installation. To
register the VM instantly, use the optional
--register option, or run
VBoxManage registervm separately
afterwards.

VBoxManage modifyvm

This command changes the properties of a registered virtual machine
which is not running. 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; these were described in
Chapter 3, Configuring virtual machines. Some of the more advanced settings,
however, are only available through the
VBoxManage interface.

These commands require that the machine is powered off (neither
running nor in “saved” state). Some machine settings can also be changed
while a machine is running; those settings will then have a corresponding
subcommand with the VBoxManage controlvm
subcommand (see the section called “VBoxManage controlvm”).

General settings

The following general settings are available through
VBoxManage modifyvm:

  • --name <name>: This
    changes the VM’s name and possibly renames the internal virtual
    machine files, as described with VBoxManage
    createvm
    above.
  • --ostype <ostype>:
    This specifies what guest operating system is supposed to run in
    the VM. To learn about the various identifiers that can be used
    here, use VBoxManage list
    ostypes
    .
  • --memory
    <memorysize>
    : This sets the amount of RAM,
    in MB, that the virtual machine should allocate for itself from
    the host. See the remarks in the section called “Creating your first virtual machine” for
    more information.
  • --vram <vramsize>:
    This sets the amount of RAM that the virtual graphics card should
    have. See the section called “Display settings” for details.
  • --acpi on|off;
    --ioapic on|off: These two
    determine whether the VM should have ACPI and I/O APIC support,
    respectively; see the section called “”Motherboard” tab” for
    details.
  • --hardwareuuid
    <uuid>
    : The UUID presented to the guest via
    memory tables (DMI/SMBIOS), hardware and guest properties. By
    default this is the same as the VM uuid. Useful when cloning a VM.
    Teleporting takes care of this automatically.
  • --cpus <cpucount>:
    This sets the number of virtual CPUs for the virtual machine (see
    the section called “”Processor” tab”). If CPU hot-plugging is
    enabled (see below), this then sets the
    maximum number of virtual CPUs that can be
    plugged into the virtual machines.
  • --rtcuseutc on|off: This
    option lets the real-time clock (RTC) operate in UTC time (see
    the section called “”Motherboard” tab”).
  • --cpuhotplug on|off: This
    enables CPU hot-plugging. When enabled, virtual CPUs can be added
    to and removed from a virtual machine while it is running. See
    the section called “CPU hot-plugging” for more information.
  • --plugcpu|unplugcpu
    <id>
    : If CPU hot-plugging is enabled (see
    above), this adds a virtual CPU to the virtual machines (or
    removes one). <id>
    specifies the index of the virtual CPU to be added or removed and
    must be a number from 0 to the maximum no. of CPUs configured with
    the --cpus option. CPU 0 can
    never be removed.
  • --cpuexecutioncap
    <1-100>
    : This setting controls how much cpu
    time a virtual CPU can use. A value of 50 implies a single virtual
    CPU can use up to 50% of a single host CPU.
  • --synthcpu on|off: This
    setting determines whether VirtualBox will expose a synthetic CPU
    to the guest to allow live migration between host systems that
    differ significantly.
  • --pae on|off: This
    enables/disables PAE (see the section called “”Processor” tab”).
  • --hpet on|off: This
    enables/disables a High Precision Event Timer (HPET) which can
    replace the legacy system timers. This is turned off by default.
    Note that Windows supports a HPET only from Vista onwards.
  • --hwvirtex on|off: This
    enables or disables the use of hardware virtualization extensions
    (Intel VT-x or AMD-V) in the processor of your host system; see
    the section called “Hardware vs. software virtualization”.
  • --hwvirtexexcl on|off: This
    specifies whether VirtualBox will make exclusive use of the
    hardware virtualization extensions (Intel VT-x or AMD-V) in the
    processor of your host system; see the section called “Hardware vs. software virtualization”. If
    you wish to simultaneously share these extensions with other
    hypervisors, then you must disable this setting. Doing so has
    negative performance implications.
  • --nestedpaging on|off: If
    hardware virtualization is enabled, this additional setting
    enables or disables the use of the nested paging feature in the
    processor of your host system; see the section called “Hardware vs. software virtualization”.
  • --largepages on|off: If
    hardware virtualization and nested paging are
    enabled, for Intel VT-x only, an additional performance
    improvement of up to 5% can be obtained by enabling this setting.
    This causes the hypervisor to use large pages to reduce TLB use
    and overhead.
  • --vtxvpid on|off: If
    hardware virtualization is enabled, for Intel VT-x only, this
    additional setting enables or disables the use of the tagged TLB
    (VPID) feature in the processor of your host system; see the section called “Hardware vs. software virtualization”.
  • --accelerate3d on|off: This
    enables, if the Guest Additions are installed, whether hardware 3D
    acceleration should be available; see the section called “Hardware 3D acceleration (OpenGL and Direct3D 8/9)”.
  • You can influence the BIOS logo that is displayed when a
    virtual machine starts up with a number of settings. Per default,
    a VirtualBox logo is displayed.With --bioslogofadein
    on|off
    and --bioslogofadeout
    on|off
    , you can determine whether the logo should
    fade in and out, respectively.With --bioslogodisplaytime
    <msec>
    you can set how long the logo should
    be visible, in milliseconds.

    With --bioslogoimagepath
    <imagepath>
    you can, if you are so
    inclined, replace the image that is shown, with your own logo. The
    image must be an uncompressed 256 color BMP file.

  • --biosbootmenu
    disabled|menuonly|messageandmenu
    : This specifies
    whether the BIOS allows the user to select a temporary boot
    device. menuonly suppresses the
    message, but the user can still press F12 to select a temporary
    boot device.
  • --boot<1-4>
    none|floppy|dvd|disk|net
    : This specifies the boot
    order for the virtual machine. There are four “slots”, which the
    VM will try to access from 1 to 4, and for each of which you can
    set a device that the VM should attempt to boot from.
  • --snapshotfolder
    default|<path>
    : This allows you to specify
    the folder in which snapshots will be kept for a virtual
    machine.
  • --firmware efi|bios:
    Specifies which firmware is used to boot particular virtual
    machine: EFI or BIOS. Use EFI only if your fully understand what
    you’re doing.
  • --guestmemoryballoon
    <size>
    sets the default size of the guest
    memory balloon, that is, memory allocated by the VirtualBox Guest
    Additions from the guest operating system and returned to the
    hypervisor for re-use by other virtual machines. <size> must
    be specified in megabytes. The default size is 0 megabytes. For
    details, see the section called “Memory ballooning”.

Networking settings

The following networking settings are available through
VBoxManage modifyvm. With all these
settings, the decimal number directly following the option name (“1-N”
in the list below) specifies the virtual network adapter whose settings
should be changed.

  • --nic<1-N>
    none|null|nat|bridged|intnet|hostonly|generic
    : With
    this, you can set, for each of the VM’s virtual network cards,
    what type of networking should be available. They can be not
    present (none), not connected to
    the host (null), use network
    address translation (nat),
    bridged networking (bridged) or
    communicate with other virtual machines using internal networking
    (intnet), host-only networking
    (hostonly), or access rarely used
    sub-modes (generic).
    These options correspond
    to the modes which are described in detail in the section called “Introduction to networking modes”.
  • --nictype<1-N>
    Am79C970A|Am79C973|82540EM|82543GC|82545EM|virtio
    :
    This allows you, for each of the VM’s virtual network cards, to
    specify which networking hardware VirtualBox presents to the
    guest; see the section called “Virtual networking hardware”.
  • --cableconnected<1-N>
    on|off
    : This allows you to temporarily disconnect
    a virtual network interface, as if a network cable had been pulled
    from a real network card. This might be useful for resetting
    certain software components in the VM.
  • With the “nictrace” options, you can optionally trace
    network traffic by dumping it to a file, for debugging
    purposes.With --nictrace<1-N>
    on|off
    , you can enable network tracing for a
    particular virtual network card.If enabled, you must specify with
    --nictracefile<1-N>
    <filename>
    what file the trace should be
    logged to.
  • --bridgeadapter<1-N>
    none|<devicename>
    : If bridged networking
    has been enabled for a virtual network card (see the
    --nic option above; otherwise
    this setting has no effect), use this option to specify which host
    interface the given virtual network interface will use. For
    details, please see the section called “Bridged networking”.
  • --hostonlyadapter<1-N>
    none|<devicename>
    : If host-only networking
    has been enabled for a virtual network card (see the –nic option
    above; otherwise this setting has no effect), use this option to
    specify which host-only networking interface the given virtual
    network interface will use. For details, please see the section called “Host-only networking”.
  • --intnet<1-N>
    network
    : If internal networking has been enabled
    for a virtual network card (see the
    --nic option above; otherwise
    this setting has no effect), use this option to specify the name
    of the internal network (see the section called “Internal networking”).
  • --macaddress<1-N>
    auto|<mac>
    : With this option you can set
    the MAC address of the virtual network card. Normally, each
    virtual network card is assigned a random address by VirtualBox at
    VM creation.
  • --nicgenericdrv<1-N>
    <backend driver>
    : If generic networking has been
    enabled for a virtual network card (see the
    --nic option above; otherwise
    this setting has no effect), this mode allows you to access
    rarely used networking sub-modes, such as VDE network or UDP Tunnel.
  • --nicproperty<1-N>
    <paramname>="paramvalue"
    :
    This option, in combination with “nicgenericdrv” allows you to
    pass parameters to rarely-used network backends.Those parameters are backend engine-specific, and are different
    between UDP Tunnel and the VDE backend drivers. For example,
    please see the section called “UDP Tunnel networking”.

NAT Networking settings.

The following NAT networking settings are available through
VBoxManage modifyvm. With all these
settings, the decimal number directly following the option name (“1-N”
in the list below) specifies the virtual network adapter whose
settings should be changed.

Serial port, audio, clipboard, remote desktop and USB
settings

The following other hardware settings are available through
VBoxManage modifyvm:

  • --uart<1-N> off|<I/O base>
    <IRQ>
    : With this option you can configure
    virtual serial ports for the VM; see the section called “Serial ports” for an introduction.
  • --uartmode<1-N>
    <arg>
    : This setting controls how VirtualBox
    connects a given virtual serial port (previously configured with
    the --uartX setting, see above)
    to the host on which the virtual machine is running. As described
    in detail in the section called “Serial ports”, for each such port,
    you can specify <arg> as
    one of the following options:

    • disconnected: Even
      though the serial port is shown to the guest, it has no
      “other end” — like a real COM port without a cable.
    • server
      <pipename>
      : On a Windows host, this
      tells VirtualBox to create a named pipe on the host named
      <pipename> and
      connect the virtual serial device to it. Note that Windows
      requires that the name of a named pipe begin with
      \\.\pipe\.On a Linux host, instead of a named pipe, a local
      domain socket is used.
    • client
      <pipename>
      : This operates just like
      server ..., except that the
      pipe (or local domain socket) is not created by VirtualBox,
      but assumed to exist already.
    • <devicename>:
      If, instead of the above, the device name of a physical
      hardware serial port of the host is specified, the virtual
      serial port is connected to that hardware port. On a Windows
      host, the device name will be a COM port such as
      COM1; on a Linux host, the
      device name will look like
      /dev/ttyS0. This allows you
      to “wire” a real serial port to a virtual machine.
  • --audio none|null|oss: With
    this option, you can set whether the VM should have audio
    support.
  • --clipboard
    disabled|hosttoguest|guesttohost|bidirectional
    :
    With this setting, you can select whether the guest operating
    system’s clipboard should be shared with the host; see the section called “General settings”. This requires that the Guest
    Additions be installed in the virtual machine.
  • --monitorcount
    <count>
    : This enables multi-monitor
    support; see the section called “Display settings”.
  • --usb on|off: This option
    enables or disables the VM’s virtual USB controller; see the section called “USB settings” for details.
  • --usbehci on|off: This
    option enables or disables the VM’s virtual USB 2.0 controller;
    see the section called “USB settings” for details.

Remote machine settings

The following settings that affect remote machine behavior are
available through VBoxManage
modifyvm
:

  • --vrde on|off: With the
    VirtualBox graphical user interface, this enables or disables the
    VirtualBox remote desktop extension (VRDE) server. Note that if
    you are using VBoxHeadless (see
    the section called “VBoxHeadless, the remote desktop server”), VRDE is enabled by
    default.
  • --vrdeport
    default|<ports>
    : A port or a range of ports
    the VRDE server can bind to; “default” or “0” means port 3389, the
    standard port for RDP. You can specify a comma-separated list of
    ports or ranges of ports. Use a dash between two port numbers to
    specify a range. The VRDE server will bind to one of available ports from the specified
    list. Only one machine can use a given port at a time. For
    example, the option --vrdeport
    5000,5010-5012
    will tell the server to bind to
    one of following ports: 5000, 5010, 5011 or 5012.
  • --vrdeaddress <IP
    address>
    : The IP address of the host network
    interface the VRDE server will bind to. If specified, the server
    will accept connections only on the specified host network
    interface.
  • --vrdeauthtype
    null|external|guest
    : This allows you to choose
    whether and how authorization will be performed; see the section called “RDP authentication” for details.
  • --vrdemulticon on|off: This
    enables multiple connections to the same VRDE server, if the
    server supports this feature; see the section called “Multiple connections to the VRDP server”.
  • --vrdereusecon on|off: This
    specifies the VRDE server behavior when multiple connections are
    disabled. When this option is enabled, the server will allow a new
    client to connect and will drop the existing connection. When this
    option is disabled (this is the default setting), a new connection
    will not be accepted if there is already a client connected to the
    server.
  • --vrdevideochannel on|off:
    This enables video redirection, if it is supported by the VRDE
    server; see the section called “VRDP video redirection”.
  • --vrdevideochannelquality
    <percent>
    : Sets the image quality for video
    redirection; see the section called “VRDP video redirection”.

Teleporting settings

With the following commands for VBoxManage
modifyvm
you can configure a machine to be a target for
teleporting. See the section called “Teleporting” for an
introduction.

  • --teleporter on|off: With
    this setting you turn on or off whether a machine waits for a
    teleporting request to come in on the network when it is started.
    If “on”, when the machine is started, it does not boot the virtual
    machine as it would normally; instead, it then waits for a
    teleporting request to come in on the port and address listed with
    the next two parameters.
  • --teleporterport
    <port>
    , --teleporteraddress
    <address>
    : these must be used with
    –teleporter and tell the virtual machine on which port and
    address it should listen for a teleporting request from another
    virtual machine. <port> can
    be any free TCP/IP port number (e.g. 6000);
    <address> can be any IP
    address or hostname and specifies the TCP/IP socket to bind to.
    The default is “0.0.0.0”, which means any address.
  • --teleporterpassword
    <password>
    : if this optional argument is
    given, then the teleporting request will only succeed if the
    source machine specifies the same password as the one given with
    this command.
  • --teleporterpasswordfile
    <password>
    : if this optional argument is
    given, then the teleporting request will only succeed if the
    source machine specifies the same password as the one specified
    in the file give with this command. Use stdin
    to read the password from stdin.
  • --cpuid <leaf> <eax> <ebx>
    <ecx> <edx>
    : Advanced users can use
    this command before a teleporting operation to restrict the
    virtual CPU capabilities that VirtualBox presents to the guest
    operating system. This must be run on both the source and the
    target machines involved in the teleporting and will then modify
    what the guest sees when it executes the
    CPUID machine instruction. This
    might help with misbehaving applications that wrongly assume that
    certain CPU capabilities are present. The meaning of the
    parameters is hardware dependent; please refer to the AMD or Intel
    processor manuals.

VBoxManage clonevm

This command creates a full or linked copy of an existing virtual
machine.

The clonevm subcommand takes at
least the name of the virtual machine which should be cloned. The following
additional settings can be used to further configure the clone VM
operation:

  • --snapshot <uuid>|<name>:
    Select a specific snapshot where the clone operation should refer
    to. Default is referring to the current state.
  • --mode machine|machineandchildren|all:
    Selects the cloning mode of the operation. If
    machine is selected (the default),
    the current state of the VM without any snapshots is cloned. In the
    machineandchildren mode the snapshot
    provided by --snapshot and all
    child snapshots are cloned. If all
    is the selected mode all snapshots and the current state are cloned.
  • --options link|keepallmacs|keepnatmacs|keepdisknames:
    Allows additional fine tuning of the clone operation. The first
    option defines that a linked clone should be created, which is
    only possible for a machine clone from a snapshot. The next two
    options allow to define how the MAC addresses of every virtual
    network card should be handled. They can either be reinitialized
    (the default), left unchanged
    (keepallmacs) or left unchanged
    when the network type is NAT
    (keepnatmacs). If you add
    keepdisknames all new disk images
    are called like the original once, otherwise they are
    renamed.
  • --name <name>: Select a
    new name for the new virtual machine. Default is “Original Name
    Clone”.
  • --basefolder <basefolder>:
    Select the folder where the new virtual machine configuration should
    be saved in.
  • --uuid <uuid>:
    Select the UUID the new VM should have. This id has to be unique in
    the VirtualBox instance this clone should be registered. Default is
    creating a new UUID.
  • --register:
    Automatically register the new clone in this VirtualBox
    installation. If you manually want register the new VM later, see
    the section called “VBoxManage registervm / unregistervm” for instructions how to do
    so.

VBoxManage import

This command imports a virtual appliance in OVF format by copying
the virtual disk images and creating virtual machines in VirtualBox. See
the section called “Importing and exporting virtual machines” for an introduction to appliances.

The import subcommand takes at
least the path name of an OVF file as input and expects the disk images,
if needed, in the same directory as the OVF file. A lot of additional
command-line options are supported to control in detail what is being
imported and modify the import parameters, but the details depend on the
content of the OVF file.

It is therefore recommended to first run the import subcommand with
the --dry-run or
-n option. This will then print a
description of the appliance’s contents to the screen how it would be
imported into VirtualBox, together with the optional command-line options
to influence the import behavior.

As an example, here is the screen output with a sample appliance
containing a Windows XP guest:

VBoxManage import WindowsXp.ovf --dry-run
Interpreting WindowsXp.ovf...
OK.
Virtual system 0:
 0: Suggested OS type: "WindowsXP"
    (change with "--vsys 0 --ostype <type>"; use "list ostypes" to list all)
 1: Suggested VM name "Windows XP Professional_1"
    (change with "--vsys 0 --vmname <name>")
 3: Number of CPUs: 1
    (change with "--vsys 0 --cpus <n>")
 4: Guest memory: 956 MB (change with "--vsys 0 --memory <MB>")
 5: Sound card (appliance expects "ensoniq1371", can change on import)
    (disable with "--vsys 0 --unit 5 --ignore")
 6: USB controller
    (disable with "--vsys 0 --unit 6 --ignore")
 7: Network adapter: orig bridged, config 2, extra type=bridged
 8: Floppy
    (disable with "--vsys 0 --unit 8 --ignore")
 9: SCSI controller, type BusLogic
    (change with "--vsys 0 --unit 9 --scsitype {BusLogic|LsiLogic}";
    disable with "--vsys 0 --unit 9 --ignore")
10: IDE controller, type PIIX4
    (disable with "--vsys 0 --unit 10 --ignore")
11: Hard disk image: source image=WindowsXp.vmdk,
      target path=/home/user/disks/WindowsXp.vmdk, controller=9;channel=0
    (change controller with "--vsys 0 --unit 11 --controller <id>";
    disable with "--vsys 0 --unit 11 --ignore")

As you can see, the individual configuration items are numbered, and
depending on their type support different command-line options. The import
subcommand can be directed to ignore many such items with a
--vsys X --unit Y --ignore option, where
X is the number of the virtual system (zero unless there are several
virtual system descriptions in the appliance) and Y the item number, as
printed on the screen.

In the above example, Item #1 specifies the name of the target
machine in VirtualBox. Items #9 and #10 specify hard disk controllers,
respectively. Item #11 describes a hard disk image; in this case, the
additional --controller option indicates
which item the disk image should be connected to, with the default coming
from the OVF file.

You can combine several items for the same virtual system behind the
same --vsys option. For example, to
import a machine as described in the OVF, but without the sound card and
without the USB controller, and with the disk image connected to the IDE
controller instead of the SCSI controller, use this:

VBoxManage import WindowsXp.ovf
      --vsys 0 --unit 5 --ignore --unit 6 --ignore --unit 11 --controller 10

VBoxManage export

This command exports one or more virtual machines from VirtualBox
into a virtual appliance in OVF format, including copying their virtual
disk images to compressed VMDK. See the section called “Importing and exporting virtual machines” for an
introduction to appliances.

The export command is simple to
use: list the machine (or the machines) that you would like to export to
the same OVF file and specify the target OVF file after an additional
--output or
-o option. Note that the directory of the
target OVF file will also receive the exported disk images in the
compressed VMDK format (regardless of the original format) and should have
enough disk space left for them.

Beside a simple export of a given virtual machine, you can append
several product information to the appliance file. Use
--product,
--producturl,
--vendor,
--vendorurl and
--version to specify this additional
information. For legal reasons you may add a license text or the content
of a license file by using the --eula and
--eulafile option respectively. As with
OVF import, you must use the --vsys X
option to direct the previously mentioned options to the correct virtual
machine.

For virtualization products which aren’t fully compatible with the
OVF standard 1.0 you can enable a OVF 0.9 legacy mode with the
--legacy09 option.

VBoxManage startvm

This command starts a virtual machine that is currently in the
“Powered off” or “Saved” states.

Note

This is provided for backwards compatibility only. We recommend to
start virtual machines directly by running the respective front-end, as
you might otherwise miss important error and state information that
VirtualBox may display on the console. This is especially important for
front-ends other than VirtualBox, our
graphical user interface, because those cannot display error messages in
a popup window. See the section called “VBoxHeadless, the remote desktop server” for more
information.

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, with VRDE enabled or not;
see the section called “VBoxHeadless, the remote desktop server” for more information. The list of
types is subject to change, and it’s not guaranteed that all types are
accepted by any product variant.

The following values are allowed:

gui
Starts a VM showing a GUI window. This is the default.
headless
Starts a VM without a window for remote display only.

VBoxManage controlvm

The controlvm subcommand allows you
to change the state of a virtual machine that is currently running. The
following can be specified:

  • VBoxManage controlvm <vm>
    pause
    temporarily puts a virtual machine on hold,
    without changing its state for good. The VM window will be painted
    in gray to indicate that the VM is currently paused. (This is
    equivalent to selecting the “Pause” item in the “Machine” menu of
    the GUI.)
  • Use VBoxManage controlvm <vm>
    resume
    to undo a previous
    pause command. (This is equivalent
    to selecting the “Resume” item in the “Machine” menu of the
    GUI.)
  • VBoxManage controlvm <vm>
    reset
    has the same effect on a virtual machine as
    pressing the “Reset” button on a real computer: a cold reboot of the
    virtual machine, which will restart and boot the guest operating
    system again immediately. The state of the VM is not saved
    beforehand, and data may be lost. (This is equivalent to selecting
    the “Reset” item in the “Machine” menu of the GUI.)
  • VBoxManage controlvm <vm>
    poweroff
    has the same effect on a virtual machine
    as pulling the power cable on a real computer. Again, the state of
    the VM is not saved beforehand, and data may be lost. (This is
    equivalent to selecting the “Close” item in the “Machine” menu of
    the GUI or pressing the window’s close button, and then selecting
    “Power off the machine” in the dialog.)After this, the VM’s state will be “Powered off”. From there,
    it can be started again; see the section called “VBoxManage startvm”.
  • VBoxManage controlvm <vm>
    savestate
    will save the current state of the VM to
    disk and then stop the VM. (This is equivalent to selecting the
    “Close” item in the “Machine” menu of the GUI or pressing the
    window’s close button, and then selecting “Save the machine state”
    in the dialog.)After this, the VM’s state will be “Saved”. From there, it can
    be started again; see the section called “VBoxManage startvm”.
  • VBoxManage controlvm <vm> teleport
    --hostname <name> --port <port> [--password
    <password>]
    makes the machine the source of a
    teleporting operation and initiates a teleport to the given target.
    See the section called “Teleporting” for an introduction. If the
    optional password is specified, it must match the password that was
    given to the modifyvm command for
    the target machine; see the section called “Teleporting settings” for details.

A few extra options are available with
controlvm that do not directly affect the
VM’s running state:

  • The setlinkstate<1-N>
    operation connects or disconnects virtual network cables from their
    network interfaces.
  • nic<1-N>
    null|nat|bridged|intnet|hostonly|generic
    : With this, you can
    set, for each of the VM’s virtual network cards, what type of
    networking should be available. They can be not connected to the host
    (null), use network address
    translation (nat), bridged networking
    (bridged) or communicate with other
    virtual machines using internal networking
    (intnet) or host-only networking
    (hostonly) or access to rarely used
    sub-modes
    (generic). These options correspond
    to the modes which are described in detail in the section called “Introduction to networking modes”.
  • usbattach and
    usbdettach make host USB devices
    visible to the virtual machine on the fly, without the need for
    creating filters first. The USB devices can be specified by UUID
    (unique identifier) or by address on the host system.You can use VBoxManage list
    usbhost
    to locate this information.
  • vrde on|off lets you enable or
    disable the VRDE server, if it is installed.
  • vrdeport default|<ports>
    changes the port or a range of ports that the VRDE server can bind to;
    “default” or “0” means port 3389, the standard port for RDP. For
    details, see the description for the
    --vrdeport option in the section called “Serial port, audio, clipboard, remote desktop and USB
    settings”
    .
  • setvideomodehint requests that
    the guest system change to a particular video mode. This requires that
    the Guest Additions be installed, and will not work for all guest
    systems.
  • screenshotpng takes a screenshot
    of the guest display and saves it in PNG format.
  • The setcredentials operation is
    used for remote logons in Windows guests. For details, please refer to
    the section called “Automated guest logons”.
  • The guestmemoryballoon
    operation changes the size of the guest memory balloon, that is,
    memory allocated by the VirtualBox Guest Additions from the guest
    operating system and returned to the hypervisor for re-use by other
    virtual machines. This must be specified in megabytes. For details,
    see the section called “Memory ballooning”.
  • The cpuexecutioncap
    <1-100>
    : This operation controls how much cpu
    time a virtual CPU can use. A value of 50 implies a single virtual CPU
    can use up to 50% of a single host CPU.

VBoxManage discardstate

This command discards the saved state of a virtual machine which is
not currently running, which will cause its operating system to restart
next time you start it. This is the equivalent of pulling out the power
cable on a physical machine, and should be avoided if possible.

VBoxManage adoptstate

If you have a saved state file (.sav)
that is seperate from the VM configuration, you can use this command to
“adopt” the file. This will change the VM to saved state and when you
start it, VirtualBox will attempt to restore it from the saved state file
you indicated. This command should only be used in special setups.

VBoxManage snapshot

This command is used to control snapshots from the command line. A
snapshot consists of a complete copy of the virtual machine settings,
copied at the time when the snapshot was taken, and optionally a virtual
machine saved state file if the snapshot was taken while the machine was
running. After a snapshot has been taken, VirtualBox creates differencing
hard disk for each normal hard disk associated with the machine so that
when a snapshot is restored, the contents of the virtual machine’s virtual
hard disks can be quickly reset by simply dropping the pre-existing
differencing files.

The take operation takes a snapshot
of the current state of the virtual machine. You must supply a name for
the snapshot and can optionally supply a description. The new snapshot is
inserted into the snapshots tree as a child of the current snapshot and
then becomes the new current snapshot.

The delete operation deletes a
snapshot (specified by name or by UUID). This can take a while to finish
since the differencing images associated with the snapshot might need to
be merged with their child differencing images.

The restore operation will restore
the given snapshot (specified by name or by UUID) by resetting the virtual
machine’s settings and current state to that of the snapshot. The previous
current state of the machine will be lost. After this, the given snapshot
becomes the new “current” snapshot so that subsequent snapshots are
inserted under the snapshot from which was restored.

The restorecurrent operation is a
shortcut to restore the current snapshot (i.e. the snapshot from which the
current state is derived). This subcommand is equivalent to using the
“restore” subcommand with the name or UUID of the current snapshot, except
that it avoids the extra step of determining that name or UUID.

With the edit operation, you can
change the name or description of an existing snapshot.

With the showvminfo operation, you
can view the virtual machine settings that were stored with an existing
snapshot.

VBoxManage closemedium

This commands removes a hard disk, DVD or floppy image from a
VirtualBox media registry.[36]

Optionally, you can request that the image be deleted. You will get
appropriate diagnostics that the deletion failed, however the image will
become unregistered in any case.

VBoxManage storageattach

This command attaches/modifies/removes a storage medium connected to
a storage controller that was previously added with the
storagectl command (see the previous
section). The syntax is as follows:

VBoxManage storageattach    <uuid|vmname>
                            --storagectl <name>
                            [--port <number>]
                            [--device <number>]
                            [--type dvddrive|hdd|fdd]
                            [--medium none|emptydrive|
                                      <uuid>|<filename>|host:<drive>|iscsi]
                            [--mtype normal|writethrough|immutable|shareable]
                            [--comment <text>]
                            [--setuuid <uuid>]
                            [--setparentuuid <uuid>]
                            [--passthrough on|off]
                            [--tempeject on|off]
                            [--bandwidthgroup name|none]
                            [--forceunmount]
                            [--server <name>|<ip>]
                            [--target <target>]
                            [--tport <port>]
                            [--lun <lun>]
                            [--encodedlun <lun>]
                            [--username <username>]
                            [--password <password>]
                            [--intnet]

A number of parameters are commonly required; the ones at the end of
the list are required only for iSCSI targets (see below).

The common parameters are:

uuid|vmname
The VM UUID or VM Name. Mandatory.
storagectl
Name of the storage controller. Mandatory. The list of the
storage controllers currently attached to a VM can be obtained
with VBoxManage showvminfo; see
the section called “VBoxManage showvminfo”.
port
The number of the storage controller’s port which is to be
modified. Mandatory, unless the storage controller has only a
single port.
device
The number of the port’s device which is to be modified.
Mandatory, unless the storage controller has only a single device
per port.
type
Define the type of the drive to which the medium is being
attached/detached/modified. This argument can only be omitted if
the type of medium can be determined from either the medium given
with the --medium argument or
from a previous medium attachment.
medium
Specifies what is to be attached. The following values are
supported:

  • “none”: Any existing device should be removed from the
    given slot.
  • “emptydrive”: For a virtual DVD or floppy drive only,
    this makes the device slot behaves like a removeable drive
    into which no media has been inserted.
  • If a UUID is specified, it must be the UUID of a
    storage medium that is already known to VirtualBox (e.g.
    because it has been attached to another virtual machine).
    See the section called “VBoxManage list” for how to list known
    media. This medium is then attached to the given device
    slot.
  • If a filename is specified, it must be the full path
    of an existing disk image (ISO, RAW, VDI, VMDK or other),
    which is then attached to the given device slot.
  • “host:<drive>”: For a virtual DVD or floppy
    drive only, this connects the given device slot to the
    specified DVD or floppy drive on the host computer.
  • “iscsi”: For virtual hard disks only, this allows for
    specifying an iSCSI target. In this case, more parameters
    must be given; see below.

Some of the above changes, in particular for removeable
media (floppies and CDs/DVDs), can be effected while a VM is
running. Others (device changes or changes in hard disk device
slots) require the VM to be powered off.

mtype
Defines how this medium behaves with respect to snapshots
and write operations. See the section called “Special image write modes” for
details.
comment
Any description that you want to have stored with this
medium (optional; for example, for an iSCSI target, “Big storage
server downstairs”). This is purely descriptive and not needed for
the medium to function correctly.
setuuid, setparentuuid
Modifies the UUID or parent UUID of a medium before
attaching it to a VM. This is an expert option. Inappropriate use
can make the medium unusable or lead to broken VM configurations
if any other VM is referring to the same media already. The most
frequently used variant is --setuuid "", which assigns
a new (random) UUID to an image. This is useful to resolve the
duplicate UUID errors if one duplicated an image using file copy
utilities.
passthrough
For a virtual DVD drive only, you can enable DVD writing
support (currently experimental; see the section called “CD/DVD support”).
tempeject
For a virtual DVD drive only, you can configure the behavior
for guest-triggered medium eject. If this is set to “on”, the eject
has only temporary effects. If the VM is powered off and restarted
the originally configured medium will be still in the drive.
bandwidthgroup
Sets the bandwidth group to use for the given device; see
the section called “Limiting bandwidth for disk images”.
forceunmount
For a virtual DVD or floppy drive only, this forcibly
unmounts the DVD/CD/Floppy or mounts a new DVD/CD/Floppy even if
the previous one is locked down by the guest for reading. Again,
see the section called “CD/DVD support” for details.

When “iscsi” is used with the
--medium parameter for iSCSI support —
see the section called “iSCSI servers” –, additional parameters must or can
be used:

server
The host name or IP address of the iSCSI target;
required.
target
Target name string. This is determined by the iSCSI target
and used to identify the storage resource; required.
tport
TCP/IP port number of the iSCSI service on the target
(optional).
lun
Logical Unit Number of the target resource (optional).
Often, this value is zero.
username, password
Username and password for target authentication, if required
(optional).

Note

Currently, username and password are stored without
encryption (i.e. in clear text) in the XML machine
configuration file.

intnet
If specified, connect to the iSCSI target via Internal
Networking. This needs further configuration which is described in
the section called “Access iSCSI targets via Internal
Networking”
.

VBoxManage storagectl

This command attaches/modifies/removes a storage controller. After
this, virtual media can be attached to the controller with the
storageattach command (see the next
section).

The syntax is as follows:

VBoxManage storagectl       <uuid|vmname>
                            --name <name>
                            [--add <ide/sata/scsi/floppy>]
                            [--controller <LsiLogic|LSILogicSAS|BusLogic|
                                          IntelAhci|PIIX3|PIIX4|ICH6|I82078>]
                            [--sataideemulation<1-4> <1-30>]
                            [--sataportcount <1-30>]
                            [--hostiocache on|off]
                            [--bootable on|off]
                            [--remove]

where the parameters mean:

uuid|vmname
The VM UUID or VM Name. Mandatory.
name
Name of the storage controller. Mandatory.
add
Define the type of the system bus to which the storage
controller must be connected.
controller
Allows to choose the type of chipset being emulated for the
given storage controller.
sataideemulation
This specifies which SATA ports should operate in IDE
emulation mode. As explained in the section called “Hard disk controllers: IDE, SATA (AHCI), SCSI, SAS”, by default, this is the case for
SATA ports 1-4; with this command, you can map four IDE channels
to any of the 30 supported SATA ports.
sataportcount
This determines how many ports the SATA controller should
support.
hostiocache
Configures the use of the host I/O cache for all disk images
attached to this storage controller. For details, please see the section called “Host I/O caching”.
bootable
Selects whether this controller is bootable.
remove
Removes the storage controller from the VM config.

VBoxManage bandwidthctl

This command creates/deletes/modifies bandwidth groups of the given
virtual machine:

VBoxManage bandwidthctl    <uuid|vmname>
                          --name <name>
                          [--add disk
                          [--delete]
                          [--limit MB/s]

See the section called “Limiting bandwidth for disk images” for an introduction
to bandwidth limits. The parameters mean:

uuid|vmname
The VM UUID or VM Name. Mandatory.
name
Name of the bandwidth group. Mandatory.
add
Creates a new bandwdith group with the given type.
delete
Deletes a bandwdith group if it isn’t used anymore.
limit
Sets the limit for the given group to the specified amount.
Can be changed while the VM is running.

VBoxManage showhdinfo

This command shows information about a virtual hard disk image,
notably its size, its size on disk, its type and the virtual machines
which use it.

Note

For compatibility with earlier versions of VirtualBox, the
“showvdiinfo” command is also supported and mapped internally to the
“showhdinfo” command.

The disk image must be specified either by its UUID (if the medium
is registered) or by its filename. Registered images can be listed by
VBoxManage list hdds (see the section called “VBoxManage list”
for more information). A filename must be specified as valid path, either
as an absolute path or as a relative path starting from the current
directory.

VBoxManage createhd

This command creates a new virtual hard disk image. The syntax is as
follows:

VBoxManage createhd         --filename <filename>
                            --size <megabytes>
                            [--format VDI|VMDK|VHD] (default: VDI)
                            [--variant Standard,Fixed,Split2G,Stream,ESX]

where the parameters mean:

filename
Allows to choose a file name. Mandatory.
size
Allows to define the image capacity, in 1 MiB units.
Mandatory.
format
Allows to choose a file format for the output file different
from the file format of the input file.
variant
Allows to choose a file format variant for the output file.
It is a comma-separated list of variant flags. Not all
combinations are supported, and specifying inconsistent flags will
result in an error message.

Note

For compatibility with earlier versions of VirtualBox, the
“createvdi” command is also supported and mapped internally to the
“createhd” command.

VBoxManage modifyhd

With the modifyhd command, you can
change the characteristics of a disk image after it has been
created:

VBoxManage modifyhd         <uuid>|<filename>
                            [--type normal|writethrough|immutable|shareable|
                                    readonly|multiattach]
                            [--autoreset on|off]
                            [--compact]
                            [--resize <megabytes>|--resizebyte <bytes>]

Note

Despite the “hd” in the subcommand name, the command works with
all disk images, not only hard disks. For compatibility with earlier
versions of VirtualBox, the “modifyvdi” command is also supported and
mapped internally to the “modifyhd” command.

The disk image to modify must be specified either by its UUID
(if the medium is registered) or by its filename. Registered images
can be listed by VBoxManage list hdds
(see the section called “VBoxManage list” for more information).
A filename must be specified as valid path, either as an absolute path
or as a relative path starting from the current directory.

The following options are available:

  • With the --type argument, you
    can change the type of an existing image between the normal,
    immutable, write-through and other modes; see the section called “Special image write modes” for details.
  • For immutable (differencing) hard disks only, the
    --autoreset on|off option
    determines whether the disk is automatically reset on every VM
    startup (again, see the section called “Special image write modes”). The default
    is “on”.
  • With the --compact option,
    can be used to compact disk images, i.e. remove blocks that only
    contains zeroes. This will shrink a dynamically allocated image
    again; it will reduce the physical size of the
    image without affecting the logical size of the virtual disk.
    Compaction works both for base images and for diff images created as
    part of a snapshot.For this operation to be effective, it is required that free
    space in the guest system first be zeroed out using a suitable
    software tool. For Windows guests, you can use the
    sdelete tool provided by Microsoft.
    Execute sdelete -c in the guest to
    zero the free disk space before compressing the virtual disk
    image. For Linux, use the zerofree utility which
    supports ext2/ext3 filesystems.Please note that compacting is currently only available for
    VDI images. A similar effect can be achieved by zeroing out free
    blocks and then cloning the disk to any other dynamically allocated
    format. You can use this workaround until compacting is also
    supported for disk formats other than VDI.
  • The --resize option allows you
    to change the capacity of an existing image; this adjusts the
    logical size of a virtual disk without affecting
    the physical size much.[37] This currently works only for expanding the capacity of
    VDI and VHD formats, and only for the dynamically allocated variants.
    For example, if you originally created a 10G disk which is now full,
    you can use the --resize 15360
    command to add 5 GByte more space to the virtual disk without
    having to create a new image and copy all data from within a virtual
    machine.

VBoxManage clonehd

This command duplicates a registered virtual hard disk image to a
new image file with a new unique identifier (UUID). The new image can be
transferred to another host system or imported into VirtualBox again using
the Virtual Media Manager; see the section called “The Virtual Media Manager” and the section called “Cloning disk images”. The syntax is as follows:

VBoxManage clonehd         <uuid>|<filename> <outputfile>
                           [--format VDI|VMDK|VHD|RAW|<other>]
                           [--variant Standard,Fixed,Split2G,Stream,ESX]
                           [--existing]

The disk image to clone as well as the target image must be described
either by its UUIDs (if the mediums are registered) or by its filename.
Registered images can be listed by VBoxManage list hdds
(see the section called “VBoxManage list” for more information).
A filename must be specified as valid path, either as an absolute path or
as a relative path starting from the current directory.

The following options are available:

format
Allow to choose a file format for the output file different
from the file format of the input file.
variant
Allow to choose a file format variant for the output file.
It is a comma-separated list of variant flags. Not all
combinations are supported, and specifying inconsistent flags will
result in an error message.
existing
Perform the clone operation to an already existing
destination medium. Only the portion of the source medium which
fits into the destination medium is copied. This means if the
destination medium is smaller than the source only a part of it is
copied, and if the destination medium is larger than the source
the remaining part of the destination medium is unchanged.

Note

For compatibility with earlier versions of VirtualBox, the
“clonevdi” command is also supported and mapped internally to the
“clonehd” command.

VBoxManage convertfromraw

This command converts a raw disk image to a VirtualBox Disk Image
(VDI) file. The syntax is as follows:

VBoxManage convertfromraw   <filename> <outputfile>
                            [--format VDI|VMDK|VHD]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--uuid <uuid>]
VBoxManage convertfromraw   stdin <outputfile> <bytes>
                            [--format VDI|VMDK|VHD]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--uuid <uuid>]

where the parameters mean:

format
Select the disk image format to create. Default is
VDI.
variant
Allow to choose a file format variant for the output file.
It is a comma-separated list of variant flags. Not all
combinations are supported, and specifying inconsistent flags will
result in an error message.
uuid
Allow to specifiy the UUID of the output file.

The second form forces VBoxManage to read the content for
the disk image from standard input (useful for using that command in a
pipe).

Note

For compatibility with earlier versions of VirtualBox, the
“convertdd” command is also supported and mapped internally to the
“convertfromraw” command.

VBoxManage getextradata/setextradata

These commands let you attach and retrieve string data to a virtual
machine or to a VirtualBox configuration (by specifying
global instead of a virtual machine
name). You must specify a key (as a text string) to associate the data
with, which you can later use to retrieve it. For example:

VBoxManage setextradata Fedora5 installdate 2006.01.01
VBoxManage setextradata SUSE10 installdate 2006.02.02

would associate the string “2006.01.01” with the key installdate for
the virtual machine Fedora5, and “2006.02.02” on the machine SUSE10. You
could retrieve the information as follows:

VBoxManage getextradata Fedora5 installdate

which would return

VirtualBox Command Line Management Interface Version 4.1.14
(C) 2005-2012 Oracle Corporation
All rights reserved.

Value: 2006.01.01

To remove a key, the setextradata
command must be run without specifying data (only the key), for example:

VBoxManage setextradata Fedora5 installdate

VBoxManage setproperty

This command is used to change global settings which affect the
entire VirtualBox installation. Some of these correspond to the settings
in the “Global settings” dialog in the graphical user interface. The
following properties are available:

machinefolder
This specifies the default folder in which virtual machine
definitions are kept; see the section called “Where VirtualBox stores its files” for
details.
vrdeauthlibrary
This specifies which library to use when “external”
authentication has been selected for a particular virtual machine;
see the section called “RDP authentication” for details.
websrvauthlibrary
This specifies which library the web service uses to
authenticate users. For details about the VirtualBox web service,
please refer to the separate VirtualBox SDK reference (see Chapter 11, VirtualBox programming interfaces).
vrdelibrary
This specifies which library implements the VirtualBox
Remote Desktop Extension.
hwvirtexenabled
This selects whether or not hardware virtualization support
is enabled by default.

VBoxManage usbfilter add/modify/remove

The usbfilter commands are used for
working with USB filters in virtual machines, or global filters which
affect the whole VirtualBox setup. Global filters are applied before
machine-specific filters, and may be used to prevent devices from being
captured by any virtual machine. Global filters are always applied in a
particular order, and only the first filter which fits a device is
applied. So for example, if the first global filter says to hold (make
available) a particular Kingston memory stick device and the second to
ignore all Kingston devices, that memory stick will be available to any
machine with an appropriate filter, but no other Kingston device
will.

When creating a USB filter using usbfilter
add
, you must supply three or four mandatory parameters.
The index specifies the position in the list at which the filter should be
placed. If there is already a filter at that position, then it and the
following ones will be shifted back one place. Otherwise the new filter
will be added onto the end of the list. The
target parameter selects the virtual
machine that the filter should be attached to or use “global” to apply it
to all virtual machines. name is a name
for the new filter and for global filters,
action says whether to allow machines
access to devices that fit the filter description (“hold”) or not to give
them access (“ignore”). In addition, you should specify parameters to
filter by. You can find the parameters for devices attached to your system
using VBoxManage list usbhost. Finally,
you can specify whether the filter should be active, and for local
filters, whether they are for local devices, remote (over an RDP
connection) or either.

When you modify a USB filter using usbfilter
modify
, you must specify the filter by index (see the
output of VBoxManage list usbfilters to
find global filter indexes and that of VBoxManage
showvminfo
to find indexes for individual machines) and
by target, which is either a virtual machine or “global”. The properties
which can be changed are the same as for usbfilter
add
. To remove a filter, use usbfilter
remove
and specify the index and the target.

VBoxManage sharedfolder add/remove

This command allows you to share folders on the host computer with
guest operating systems. For this, the guest systems must have a version
of the VirtualBox Guest Additions installed which supports this
functionality.

Shared folders are described in detail in the section called “Shared folders”.

VBoxManage guestproperty

The “guestproperty” commands allow you to get or set properties of a
running virtual machine. Please see the section called “Guest properties”
for an introduction. As explained there, guest properties are arbitrary
key/value string pairs which can be written to and read from by either the
guest or the host, so they can be used as a low-volume communication
channel for strings, provided that a guest is running and has the Guest
Additions installed. In addition, a number of values whose keys begin with
“/VirtualBox/” are automatically set and maintained by the Guest
Additions.

The following subcommands are available (where
<vm>, in each case, can either be a
VM name or a VM UUID, as with the other VBoxManage commands):

  • enumerate <vm> [--patterns
    <pattern>]
    : This lists all the guest
    properties that are available for the given VM, including the value.
    This list will be very limited if the guest’s service process cannot
    be contacted, e.g. because the VM is not running or the Guest
    Additions are not installed.If --patterns <pattern>
    is specified, it acts as a filter to only list properties that match
    the given pattern. The pattern can contain the following wildcard
    characters:

    • * (asterisk):
      represents any number of characters; for example,
      /VirtualBox*” would match
      all properties beginning with “/VirtualBox”.
    • ? (question mark):
      represents a single arbitrary character; for example,
      fo?” would match both “foo”
      and “for”.
    • | (pipe symbol): can be
      used to specify multiple alternative patterns; for example,
      s*|t*” would match anything
      starting with either “s” or “t”.
  • get <vm>: This
    retrieves the value of a single property only. If the property
    cannot be found (e.g. because the guest is not running), this will
    print

    No value set!
  • set <vm> <property> [<value>
    [--flags <flags>]]
    : This allows you to set a
    guest property by specifying the key and value. If
    <value> is omitted, the
    property is deleted. With --flags
    you can optionally specify additional behavior (you can combine
    several by separating them with commas):

    • TRANSIENT: the value
      will not be stored with the VM data when the VM exits;
    • TRANSRESET: the value
      will be deleted as soon as the VM restarts and/or exits;
    • RDONLYGUEST: the value
      can only be changed by the host, but the guest can only read
      it;
    • RDONLYHOST: reversely,
      the value can only be changed by the guest, but the host can
      only read it;
    • READONLY: a combination
      of the two, the value cannot be changed at all.
  • wait <vm> <pattern> --timeout
    <timeout>
    : This waits for a particular value
    described by “pattern” to change or to be deleted or created. The
    pattern rules are the same as for the “enumerate” subcommand
    above.

VBoxManage guestcontrol

The “guestcontrol” commands allow you to control certain things
inside a guest from the host. Please see the section called “Guest control” for an introduction.

Generally, the syntax is as follows:

VBoxManage guestcontrol <command>

The following subcommands are available (where
<vm>, in each case, can either be a
VM name or a VM UUID, as with the other VBoxManage commands):

  • execute, which allows for
    executing a program/script (process) which already is installed and
    runnable on the guest. This command only works while a VM is up and
    running and has the following syntax:

    VBoxManage guestcontrol <vmname>|<uuid> exec[ute]
                --image <path to program>
                --username <name> [--password <password>]
                [--dos2unix]
                [--environment "<NAME>=<VALUE> [<NAME>=<VALUE>]"]
                [--timeout <msec>] [--unix2dos] [--verbose]
                [--wait-exit] [--wait-stdout] [--wait-stderr]
                -- [[<argument1>] ... [<argumentN>]]

    where the parameters mean:

    uuid|vmname
    The VM UUID or VM name. Mandatory.
    –image “<path to program>”
    Absolute path and process name of process to execute
    in the guest, e.g.
    C:\Windows\System32\calc.exe
    –username <name>
    Name of the user the process should run under. This
    user must exist on the guest OS.
    –password <password>
    Password of the user account specified with
    --username. If not given,
    an empty password is assumed.
    –dos2unix
    –environment
    “<NAME>=<VALUE>”
    One or more environment variables to be set or
    unset.By default, the new process in the guest will be
    created with the standard environment of the guest OS. This
    option allows for modifying that environment. To set/modify
    a variable, a pair of
    NAME=VALUE must be
    specified; to unset a certain variable, the name with no
    value must set, e.g.
    NAME=.Arguments containing spaces must be enclosed in
    quotation marks. More than one
    --environment at a time can
    be specified to keep the command line tidy.

    –timeout <msec>
    Value (in milliseconds) that specifies the time how
    long the started process is allowed to run and how long
    VBoxManage waits for getting output from that process. If no
    timeout is specified, VBoxManage will wait forever until the
    started process ends or an error occured.
    –unix2dos
    –verbose
    Tells VBoxManage to be more verbose.
    –wait-exit
    Waits until the process ends and outputs its
    exit code along with the exit reason/flags.
    –wait-stdout
    Waits until the process ends and outputs its
    exit code along with the exit reason/flags. While waiting
    VBoxManage retrieves the process output collected from stdout.
    –wait-stderr
    Waits until the process ends and outputs its
    exit code along with the exit reason/flags. While waiting
    VBoxManage retrieves the process output collected from stderr.
    [– [<argument1s>] … [<argumentNs>]]
    One or more arguments to pass to the process being
    executed.Arguments containing spaces must be enclosed in
    quotation marks.

    Note

    On Windows there are certain limitations for graphical
    applications; please see Chapter 14, Known limitations for more
    information.

    Examples:

    VBoxManage --nologo guestcontrol "My VM" execute --image "/bin/ls"
              --username foo --password bar --wait-exit --wait-stdout -- -l /usr
    VBoxManage --nologo guestcontrol "My VM" execute --image "c:\\windows\\system32\\ipconfig.exe"
              --username foo --password bar --wait-exit --wait-stdout

    Note that
    the double backslashes in the second example are only required on
    Unix hosts.

    Note

    For certain commands a user name of an existing user account on the guest
    must be specified; anonymous executions are not supported for security reasons. A
    user account password, however, is optional and depends on the guest’s OS security
    policy or rules. If no password is specified for a given user name, an empty password
    will be used. On certain OSes like Windows the security policy may needs to be adjusted
    in order to allow user accounts with an empty password set. Also, global domain rules might
    apply and therefore cannot be changed.

    Starting at VirtualBox 4.1.2 guest process execution by default is limited
    to serve up to 5 guest processes at a time. If a new guest process gets started
    which would exceed this limit, the oldest not running guest process will be discarded
    in order to be able to run that new process. Also, retrieving output from this
    old guest process will not be possible anymore then. If all 5 guest processes
    are still active and running, starting a new guest process will result in an
    appropriate error message.

    To raise or lower the guest process execution limit, either the guest
    property /VirtualBox/GuestAdd/VBoxService/--control-procs-max-kept
    or VBoxService’ command line by specifying --control-procs-max-kept
    needs to be modified. A restart of the guest OS is required afterwards. To serve unlimited
    guest processes, a value of 0 needs to be set (not recommended).

  • copyto, which allows copying
    files from the host to the guest (only with installed Guest
    Additions 4.0 and later).

    VBoxManage guestcontrol <vmname>|<uuid> copyto|cp
                <source on host> <destination on guest>
                --username <name> [--password <password>]
                [--dryrun] [--follow] [--recursive] [--verbose]

    where the parameters mean:

    uuid|vmname
    The VM UUID or VM name. Mandatory.
    source on host
    Absolute path of source file(s) on host to copy over
    to the guest, e.g.
    C:\Windows\System32\calc.exe.
    This also can be a wildcard expression, e.g.
    C:\Windows\System32\*.dll
    destination on guest
    Absolute destination path on the guest, e.g.
    C:\Temp
    –username <name>
    Name of the user the copy process should run under.
    This user must exist on the guest OS.
    –password <password>
    Password of the user account specified with
    --username. If not given,
    an empty password is assumed.
    –dryrun
    Tells VBoxManage to only perform a dry run instead of
    really copying files to the guest.
    –follow
    Enables following symlinks on the host’s
    source.
    –recursive
    Recursively copies files/directories of the specified
    source.
    –verbose
    Tells VBoxManage to be more verbose.
    –flags <flags>
    Additional flags to set. This is not used at the
    moment.
  • createdirectory, which allows
    copying files from the host to the guest (only with installed Guest
    Additions 4.0 and later).

    VBoxManage guestcontrol <vmname>|<uuid> createdir[ectory]|mkdir|md
                <directory to create on guest>
                [--username "<name>"] [--password "<password>"]
                [--parents] [--mode <mode>] [--verbose]

    where the parameters mean:

    uuid|vmname
    The VM UUID or VM name. Mandatory.
    directory to create on guest
    Absolute path of directory/directories to create on
    guest, e.g. D:\Foo\Bar.
    Parent directories need to exist (e.g. in this example
    D:\Foo) when switch
    --parents is omitted. The
    specified user must have appropriate rights to create the
    specified directory.
    –username <name>
    Name of the user the copy process should run under.
    This user must exist on the guest OS.
    –password <password>
    Password of the user account specified with
    --username. If not given,
    an empty password is assumed.
    –parents
    Also creates not yet existing parent directories of
    the specified directory, e.g. if the directory
    D:\Foo of
    D:\Foo\Bar does not exist
    yet it will be created. Without specifying
    --parent the action would
    have failed.
    –mode <mode>
    Sets the permission mode of the specified directory.
    Only octal modes (e.g.
    0755) are supported right
    now.
    –verbose
    Tells VBoxManage to be more verbose.
  • stat, which displays file
    or file system status on the guest.

    VBoxManage guestcontrol <vmname>|<uuid> stat
                <file element(s) to check on guest>
                [--username "<name>"] [--password "<password>"]
                [--verbose]

    where the parameters mean:

    uuid|vmname
    The VM UUID or VM name. Mandatory.
    file element(s) to check on guest
    Absolute path of directory/directories to check on
    guest, e.g. /home/foo/a.out.
    The specified user must have appropriate rights to access
    the given file element(s).
    –username <name>
    Name of the user the copy process should run under.
    This user must exist on the guest OS.
    –password <password>
    Password of the user account specified with
    --username. If not given,
    an empty password is assumed.
    –verbose
    Tells VBoxManage to be more verbose.
  • updateadditions, which allows
    for updating an already installed Guest Additions version on the
    guest (only already installed Guest Additions 4.0 and later).

    VBoxManage guestcontrol <vmname>|<uuid> updateadditions
                [--source "<guest additions .ISO file to use>"] [--verbose]

    where the parameters mean:

    uuid|vmname
    The VM UUID or VM name. Mandatory.
    –source “<guest additions .ISO file to
    use>”
    Full path to an alternative VirtualBox Guest Additions
    .ISO file to use for the Guest Additions update.
    –verbose
    Tells VBoxManage to be more verbose.

VBoxManage debugvm

The “debugvm” commands are for experts who want to tinker with the
exact details of virtual machine execution. Like the VM debugger described
in the section called “The built-in VM debugger”, these commands are only useful if you are
very familiar with the details of the PC architecture and how to debug
software.

The subcommands of “debugvm” all operate on a running virtual
machine. The following are available:

  • With dumpguestcore --filename
    <name>
    , you can create a system dump of the
    running VM, which will be written into the given file. This file
    will have the standard ELF core format (with custom sections); see
    the section called “VM core format”.This corresponds to the
    writecore command in the debugger.
  • The info command is used to
    display info items relating to the VMM, device emulations and
    associated drivers. This command takes one or two arguments: the
    name of the info item, optionally followed by a string containing
    arguments specific to the info item.
    The help info item provides a
    listning of the available items and hints about any optional
    arguments.This corresponds to the info
    command in the debugger.
  • The injectnmi command causes
    a non-maskable interrupt (NMI) in the guest, which might be useful
    for certain debugging scenarios. What happens exactly is dependent
    on the guest operating system, but an NMI can crash the whole guest
    operating system. Do not use unless you know what you’re
    doing.
  • The osdetect command makes the
    VMM’s debugger facility (re-)detection the guest operation
    system.This corresponds to the detect
    command in the debugger.
  • The osinfo command is used to
    display info about the operating system (OS) detected by the VMM’s
    debugger facility.
  • The getregisters command is
    used to display CPU and device registers. The command takes a list
    of registers, each having one of the following forms:

    • register-set.register-name.sub-field
    • register-set.register-name
    • cpu-register-name.sub-field
    • cpu-register-name
    • all

    The all form will cause all
    registers to be shown (no sub-fields). The registers names are
    case-insensitive. When requesting a CPU register the register set
    can be omitted, it will be selected using the value of the
    --cpu option (defaulting to 0).

  • The setregisters command is
    used to change CPU and device registers. The command takes a list
    of register assignments, each having one of the following forms:

    • register-set.register-name.sub-field=value
    • register-set.register-name=value
    • cpu-register-name.sub-field=value
    • cpu-register-name=value

    The value format should be in the same style as what
    getregisters displays, with the
    exception that both octal and decimal can be used instead of
    hexadecimal. The register naming and the default CPU register set
    are handled the same way as with the
    getregisters command.

  • The statistics command can be
    used to display VMM statistics on the command line. The
    --reset option will reset
    statistics. The affected statistics can be filtered with the
    --pattern option, which accepts
    DOS/NT-style wildcards (? and
    *).

VBoxManage metrics

This command supports monitoring the usage of system resources.
Resources are represented by various metrics associated with the host
system or a particular VM. For example, the host system has a
CPU/Load/User metric that shows the
percentage of time CPUs spend executing in user mode over a specific
sampling period.

Metric data is collected and retained internally; it may be
retrieved at any time with the VBoxManage metrics
query
subcommand. The data is available as long as the
background VBoxSVC process is alive. That
process terminates shortly after all VMs and frontends have been
closed.

By default no metrics are collected at all. Metrics collection does
not start until VBoxManage metrics setup
is invoked with a proper sampling interval and the number of metrics to be
retained. The interval is measured in seconds. For example, to enable
collecting the host processor and memory usage metrics every second and
keeping the 5 most current samples, the following command can be
used:

VBoxManage metrics setup --period 1 --samples 5 host CPU/Load,RAM/Usage

Metric collection can only be enabled for started VMs. Collected
data and collection settings for a particular VM will disappear as soon as
it shuts down. Use VBoxManage metrics list
subcommand to see which metrics are currently available.
You can also use --list option with any
subcommand that modifies metric settings to find out which metrics were
affected.

Note that the VBoxManage metrics
setup
subcommand discards all samples that may have been
previously collected for the specified set of objects and metrics.

To enable or disable metrics collection without discarding the data
VBoxManage metrics enable and
VBoxManage metrics disable subcommands
can be used. Note that these subcommands expect metrics, not submetrics,
like CPU/Load or RAM/Usage as parameters. In
other words enabling CPU/Load/User while disabling
CPU/Load/Kernel is not supported.

The host and VMs have different sets of associated metrics.
Available metrics can be listed with VBoxManage metrics
list
subcommand.

A complete metric name may include an aggregate function. The name
has the following form:
Category/Metric[/SubMetric][:aggregate].
For example, RAM/Usage/Free:min stands
for the minimum amount of available memory over all retained data if
applied to the host object.

Subcommands may apply to all objects and metrics or can be limited
to one object or/and a list of metrics. If no objects or metrics are given
in the parameters, the subcommands will apply to all available metrics of
all objects. You may use an asterisk
(“*“) to explicitly specify that the
command should be applied to all objects or metrics. Use “host” as the
object name to limit the scope of the command to host-related metrics. To
limit the scope to a subset of metrics, use a metric list with names
separated by commas.

For example, to query metric data on the CPU time spent in user and
kernel modes by the virtual machine named “test”, you can use the
following command:

VBoxManage metrics query test CPU/Load/User,CPU/Load/Kernel

The following list summarizes the available subcommands:

list
This subcommand shows the parameters of the currently existing
metrics. Note that VM-specific metrics are only available when a
particular VM is running.
setup
This subcommand sets the interval between taking two samples
of metric data and the number of samples retained internally. The
retained data is available for displaying with the
query subcommand. The --list
option shows which metrics have been modified as
the result of the command execution.
enable
This subcommand “resumes” data collection after it has been
stopped with disable subcommand. Note that specifying
submetrics as parameters will not enable underlying metrics. Use
--list to find out if the command
did what was expected.
disable
This subcommand “suspends” data collection without affecting
collection parameters or collected data. Note that specifying
submetrics as parameters will not disable underlying metrics. Use
--list to find out if the command
did what was expected.
query
This subcommand retrieves and displays the currently retained
metric data.

Note

The query subcommand does not remove or
“flush” retained data. If you query often enough you will see
how old samples are gradually being “phased out” by new
samples.

collect
This subcommand sets the interval between taking two samples
of metric data and the number of samples retained internally. The
collected data is displayed periodically until Ctrl-C is pressed
unless the --detach option is
specified. With the --detach
option, this subcommand operates the same way as setup
does. The --list option shows which
metrics match the specified filter.

VBoxManage hostonlyif

With “hostonlyif” you can change the IP configuration of a host-only
network interface. For a description of host-only networking, please
refer to the section called “Host-only networking”. Each host-only interface is
identified by a name and can either use the internal DHCP server or a
manual IP configuration (both IP4 and IP6).

VBoxManage dhcpserver

The “dhcpserver” commands allow you to control the DHCP server that
is built into VirtualBox. You may find this useful when using internal or
host-only networking. (Theoretically, you can enable it for a bridged
network as well, but that will likely cause conflicts with other DHCP
servers in your physical network.)

Use the following command line options:

  • If you use internal networking for a virtual network adapter
    of a virtual machine, use VBoxManage dhcpserver add
    --netname <network_name>
    , where
    <network_name> is the same
    network name you used with VBoxManage modifyvm
    <vmname> --intnet<X>
    <network_name>
    .
  • If you use host-only networking for a virtual network adapter
    of a virtual machine, use VBoxManage dhcpserver add
    --ifname <hostonly_if_name>
    instead, where
    <hostonly_if_name> is the
    same host-only interface name you used with
    VBoxManage modifyvm <vmname>
    --hostonlyadapter<X>
    <hostonly_if_name>
    .Alternatively, you can also use the –netname option as with
    internal networks if you know the host-only network’s name; you can
    see the names with VBoxManage list
    hostonlyifs
    (see the section called “VBoxManage list”
    above).

The following additional parameters are required when first adding a
DHCP server:

  • With --ip, specify the IP
    address of the DHCP server itself.
  • With --netmask, specify the
    netmask of the network.
  • With --lowerip and
    --upperip, you can specify the
    lowest and highest IP address, respectively, that the DHCP server
    will hand out to clients.

Finally, you must specify --enable
or the DHCP server will be created in the disabled state, doing
nothing.

After this, VirtualBox will automatically start the DHCP server for
given internal or host-only network as soon as the first virtual machine
which uses that network is started.

Reversely, use VBoxManage dhcpserver
remove
with the given --netname
<network_name>
or --ifname
<hostonly_if_name>
to remove the DHCP server again
for the given internal or host-only network.

To modify the settings of a DHCP server created earlier with
VBoxManage dhcpserver add, you can use
VBoxManage dhcpserver modify for a given
network or host-only interface name.

VBoxManage extpack

The “extpack” command allows you to add or remove VirtualBox
extension packs, as described in the section called “Installing VirtualBox and extension packs”.

  • To add a new extension pack, use VBoxManage
    extpack install <tarball>
    . This command
    will fail if an older version of the same extension pack is already
    installed. The optional --replace
    parameter can be used to uninstall the old package before the new
    package is installed.
  • To remove a previously installed extension pack, use
    VBoxManage extpack uninstall
    <name>
    . You can use
    VBoxManage list extpacks to show
    the names of the extension packs which are currently installed;
    please see the section called “VBoxManage list” also. The optional
    --force parameter can be used to
    override the refusal of an extension pack to be uninstalled.
  • The VBoxManage extpack
    cleanup
    command can be used to remove temporary
    files and directories that may have been left behind if a previous
    install or uninstall command failed.

[36] Before VirtualBox 4.0, it was necessary to call VBoxManage
openmedium before a medium could be attached to a virtual machine;
that call “registered” the medium with the global VirtualBox media
registry. With VirtualBox 4.0 this is no longer necessary; media are
added to media registries automatically. The “closemedium” call has
been retained, however, to allow for explicitly removing a medium from
a registry.

[37] Image resizing was added with VirtualBox 4.0.

Sobre Alexandre Pires

ORACLE OCS Goldengate Specialist, OCE RAC 10g R2, OCP 12C, 11g, 10g , 9i e 8i - Mais de 25 anos de experiência na área de TI. Participei de projetos na G&P alocado na TOK STOK, EDINFOR alocado na TV CIDADE "NET", 3CON Alocado no PÃO DE AÇUCAR, DISCOVER alocado na VIVO, BANCO IBI e TIVIT, SPC BRASIL, UOLDIVEO alocado no CARREFOUR e atualmente na ORACLE ACS atendendo os seguintes projetos: VIVO, CLARO, TIM, CIELO, CAIXA SEGUROS, MAPFRE, PORTO SEGURO, SULAMERICA, BRADESCO SEGUROS, BANCO BRADESCO, BASA, SANTANDER, CNJ, TSE, ELETROPAULO, EDP, SKY, NATURA, ODEBRESHT, NISSEI, SICREDI, CELEPAR, TAM, TIVIT, IBM, SMILES, CELEPAR, SERPRO,OKI,BANCO PAN, etc
Esse post foi publicado em VIRTUAL BOX e marcado , , , , , . Guardar link permanente.

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s