VirtualBox and Multiple Monitors

July 26th, 2012

As a SharePoint consultant, I really enjoy having a local copy of a full SharePoint server on my laptop. As I am patiently waiting for Windows 8 to release with Client Hyper-V, I’m continuing to use Oracle’s VirtualBox software to host my SharePoint development environments.

With my current engagement, I find myself in my client’s offices Monday through Thursday and at my office on Friday. At my office, I have an external monitor that I use in addition to my laptop’s screen. At my client’s offices, I just have my laptop’s screen to use. Whenever I’m able to have a secondary monitor connected, I like to use VirtualBox’s multiple monitor support to show my VM on both of my screens. VirtualBox achieves this look by opening two windows – each window meant to be maximized on one of the two monitors.

On Fridays I get to use two monitors with two VirtualBox windows. However, come Monday, I typically forget to reset the virtual machine back to one monitor. Even though I’m only using one monitor, VirtualBox still opens two windows for me! With only one monitor, this makes the VM very tough to use. The only remedy is to shut down the VM, reconfigure the setting, and restart the machine; a process that can be quite lengthy on a server with SharePoint 2010 and SQL installed!

I turned to PowerShell to help ease my Monday morning woes. I developed the script below and put a link in my Startup folder so that, each morning when I boot my laptop, all of my VirtualBox VMs will be automatically configured to use the number of monitors that I currently have connected to my laptop.

Fair warning – this was a quick script just for my personal use. While it should work for you, it does not have any error handling to report if things go awry. See the comments in the script for details.

Tags: , ,

3 Responses to “VirtualBox and Multiple Monitors”

  1. Bob Eldredge Says:

    LOVE IT! Hahahah – I ask, why not!?

  2. VirtualBox – PowerShell Script to Start a Virtual Machine with the Maximum Number of Monitors « Andre's Technology Blog Says:

    […] I found this blog entry, which has a similar script (although some of the mechanics are different). Like this:LikeOne […]

  3. XanderAdams Says:

    I discovered your blog site on google and check a few of your early posts. Continue to keep up the very good operate.Thanks for the sharing.

Leave a Reply