Change resolution from command line in virtual box

18

11

In virtual box, how can I change the screen resolution from the command line? (Or if there's one for any type of computer, that might work too).

fxfxxf

Posted 2009-08-28T21:41:48.800

Reputation:

– Cloud – 2012-05-23T19:57:40.197

1Do you want to do this from the host or guest command line? – CarlF – 2009-10-11T03:52:49.110

2maybe its me, but whats the OS? – Jakub – 2009-12-21T15:38:23.617

Answers

19

You can quickly "hint" the window to a specific size with the following command:

VBoxManage controlvm <uuid>|<name> setvideomodehint <xres> <yres> <bpp>

For example, if you have a guest called "Windows XP Pro", and you wish to set the resolution to 1024x600 at 32 bits per pixel (aka 32 bit) you would use the following command:

VBoxManage controlvm "Windows XP Pro" setvideomodehint 1024 600 32

There are some prerequisites for this however:

  1. This only works if you've launched the Guest OS from a windowed environment on the Host OS (ie. Windows / X Windows / Mac OS Desktop).

  2. Guest Additions must be installed in the Guest OS.

user31218

Posted 2009-08-28T21:41:48.800

Reputation:

Is it possible to persist this setting somehow? – naitsirch – 2018-01-10T08:57:01.850

VirtualBox OSE 4.0.4 doesn't let you change the resolution to larger than normal display size with that. – cweiske – 2011-09-07T20:45:34.617

2Also note that that command must be run while the VM is running. My experience also indicates that it is necessary to set VBoxManage setextradata global GUI/MaxGuestResolution any (before starting the VM). The auto resize should also be disabled in the view menu. If the intended resolution is particularly high (especially if it's higher than the host resolution), more video memory may have to be assigned. – Bob – 2012-07-03T12:03:17.970

3

First, the vm must be turned on, you can power on with command:

# VBoxManage startvm "VPN" --type headless

Before you can change the resolution:

# VBoxManage controlvm "VPN" setvideomodehint 1024 768 24

Roberto Góes

Posted 2009-08-28T21:41:48.800

Reputation: 131

2

If you wish to change it from within the guest:

In Windows: there are a couple tools that allow you to do this easily from the command line, notably Display Changer.

In Linux: Use xrandr -q to list available display modes, then xrandr -s # where # is the number of the display mode you wish to use. xrandr -q will display these number options next to each display option.

John T

Posted 2009-08-28T21:41:48.800

Reputation: 149 037

1the 10k x 8k resolution i tried to set with display changer did have no effect on virtualbox ose 4.0.4 – cweiske – 2011-09-07T20:42:48.520

1

$ VBoxManage setextradata "WinXP" "CustomVideoMode1" "1440x900x16"
Where "WinXP" is your virtual machine name. This solution is somewhat close to truth :)

kolypto

Posted 2009-08-28T21:41:48.800

Reputation: 2 861

does not work here on VirtualBox OSE 4.0.4 – cweiske – 2011-09-07T20:42:08.143

0

Look inside the documentation provided with VirtualBox. The VBoxManage program gives you the ability to modify VMs from the command line. You can't do this while the machine is running, however. To do that you'll need to find a way to script the resolution change for the operating system you are virtualizing.

Dan Walker

Posted 2009-08-28T21:41:48.800

Reputation: 8 869

please note that in some cases you will have to install "guest additions" in order to properly use VBoxManage, see may question regarding a similar issue: http://superuser.com/questions/30924/resolution-issues-running-ubuntu-on-virtualbox

– Uwe Honekamp – 2009-08-29T08:12:16.927

0

The MS Windows RDP client for Mac OSX has a preference setting that I had to adjust in addition to adding the custom video modes (shown above).

Select Preferences from the RDC menu, then click on 'Display'. (I was going to post a screen image, but the spam prevention feature prevented it.)

By selecting 'Full screen', I was able to get the display mode changed to the full screen of the client computer. In this case, a MacBook with a screen resolution of 1280x800.

Jerry Lumpkins

Posted 2009-08-28T21:41:48.800

Reputation: 9

1Upload the image/link without embedding it and someone will fix it. Also "Shown above" dosen't really cut it since the order of answers changes on SU - you may want to explicitly reference which answer you're referring to in future – Journeyman Geek – 2012-06-10T00:57:03.830