Run a process in VirtualBox from outside

You can launch a program within an Oracle VirtualBox virtual machine from the host system’s command prompt.

Example 1:  Run notepad in MS Windows 7 virtual machine named “7” as user “user” with password “1” from Ubuntu:

  • VBoxManage guestcontrol "7" run --exe "C:\\Windows\\notepad.exe" --username user --password 1

Example 2: Output guest network info:

  • VBoxManage --nologo guestcontrol "7" run --exe "c:\\windows\\system32\\ipconfig.exe" --username user --password 1 --wait-stdout

Notes:

  • You must have Guest Additions installed
  • The user account must have a password
Advertisements

Disable VirtualBox clock synchronization

For whatever reason you may want to disable the time/date synchronization between the VirtualBox guest system and the host OS.

See the example below to do that for an example virtual machine “myName”:

  • vmname=”myName”; printf “Disabling clock sync for vm: \”$vmname\”\n”; VBoxManage setextradata $vmname “VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled” 1; VBoxManage setextradata $vmname “VBoxInternal/TM/TSCTiedToExecution” 1;

Unfortunately this is ignored when the virtual machine is shut down and then started again. The clock of the virtual machine will be forcefully synchronized to the host system clock. If you know a workaround, please post it in comments.


Video capture VirtualBox from command line

Start and then stop VirtualBox screen recording from command line for a headless Windows 10 session running in virtual machine named Win10:

  • VBoxManage controlvm Win10 videocap on
  • VBoxManage controlvm Win10 videocap off

Windows 10 icon PNG

A 48×48 pixel PNG icon for use with Linux desktops.

Can be used to start a virtual machine with MS Windows 10 inside.

Windows 10 icon, PNG, 48x48 pixels

Windows 10 icon, PNG, 48×48 pixels


VirtualBox: Could not claim parallel port

You try to run Oracle VirtualBox with a direct access to the parallel port at your Linux box, but it fails with the following error message:

Error: failed to start machine. Error message: Parallel#0 could not claim parallel port ‘/dev/parport0’Be sure that no other process or driver accesses this port (VERR_DEV_IO_ERROR).
Parallel device 0 cannot attach to host driver (VERR_DEV_IO_ERROR)

The main point: you have to unload the Linux kernel module lp, which is blocking access to the port, like this:

  • rmmod lp

 

P.S.

You might also either add your user to groups having file access permissions for the device or modifying the permissions to give access to more users.


Creating Oracle VirtualBox virtual machine from command line

This is how you create, on a server without a GUI, a  virtual machine with 128 MB RAM and 5 GB HDD, with a virtual network adapter (enabling you to connect to it by a Remote Desktop client), and with a Microsoft Windows installation disk image in the virtual DVD drive: Read the rest of this entry »


Reboot Oracle virtual machine

So you have this virtual machine of yours running in the Oracle VirtualBox. You connect to it remotely using Terminal Services client. But then you have to reboot it.

Unfortunately it looks that there is no way to do it from the client, i.e. from within of the virtual machine itself. You need to have access to the host system where the VirtualBox software is running. And even then you can not do it from the GUI, you shall go to the command line interface and issue a text command. The bright side is that it works instantly.

The reboot command for Windows and Linux host systems respectively may look like this (substitute the virtual machine name with the actual name of your installation):

“C:\Program Files\Oracle\VirtualBox\VBoxManage” controlvm “MS Windows XP” reset

or this

VBoxManage controlvm “MS Windows XP” reset