Sunday, August 26, 2012

How to change the graphical resolution supported by Virtualbox

Oracle's virtual machine Virtualbox is a great way to experiment with the new Windows8 but by default the video driver of virtualbox 4.1.20 offers only the following resolutions:
  • 1600x1200
  • 1280x1024
  • 1152x864
  • 1024x768
There is however a trick to enable other resolutions by using the command.

VBoxManage.exe

I wanted to have access to my screen native resolution (1920x1080) as well as the minimum screen resolution used by Windows8 (1366x768)

By using the following commands I was able to add those 2 resolutions

> VBoxManage.exe setextradata "WIN8RTM"  CustomVideoMode1 1920x1080x32
> VBoxManage.exe setextradata "WIN8RTM"  CustomVideoMode2 1366x768x32 

Where WIN8RTM is the name of my virtual machine

NOTE:
  1. The 32 is the color depth (32 = a color depth of 32 bits i.e. 16.7millions of colors)
  2. You must restart the virtual machine to take those settings into account (rebooting the virtual machine is not enough)
  3. Don't overlook the quotes around the virtual machine name! (I lost half an hour searching what was wrong because I had forgotten the quotes

Once the setting is done you can check if it is correct by using the command

> VBoxManage.exe getextradata "WIN8RTM" enumerate              

which produces the following result

Key: CustomVideoMode1, Value: 1920x1080x32                     
Key: CustomVideoMode2, Value: 1366x768x32                      
Key: GUI/Fullscreen, Value: on                                 
Key: GUI/LastCloseAction, Value: powerOff                      
Key: GUI/LastGuestSizeHint, Value: 1024,768                    
Key: GUI/LastNormalWindowPosition, Value: 640,218,1024,819,max 
Key: GUI/MiniToolBarAlignment, Value: bottom                   
Key: GUI/MiniToolBarAutoHide, Value: off                       
Key: GUI/SaveMountedAtRuntime, Value: yes                      
Key: GUI/ShowMiniToolBar, Value: yes                           
Key: GUI/VirtualScreenToHostScreen0, Value: 1