I've played with Microsoft's Virtual Server and Virtual PC products in the past, but never gave them more than a cursory look just to see what they hype is all about; I never personally saw a need to start using them. Well, my eyes have finally been opened. I remembered reading one of Scott Hanselman's blog posts in which he described using Virtual Machines (VM) for presentations, turning on the "Undo Disks" option in order to quickly reset the VM back to its original state. That's when the light bulb went off. What have I been doing all this time? How could I just be learning about this? I'm sure to many of you this may be old news, but to me its the fountain of youth for my system. I'm tired of rebuilding my laptop or PC every 6 months. I want a way to keep my development machine clean and running smoothly while at the same time accommodating my frequent indiscretions with potentially unsafe software. That's right, I want to install all the cool betas as soon as they are released. I want to play with software toys from unknown sources and to try out interesting (and unsafe) ways to hack my system. I want to do all this, while at the same time not compromising my system. Enter Virtual PC to save the day.
With Virtual PC I can load up a copy (a valid, full licensed copy) of Vista or Windows Server 2008 in a VM, creating my own little virtual sandbox to play in, resting easy knowing that my system is safe from harm. I can download all the fun bits to play with and hack away all day long, making a (potentially) big mess of things. And when the day is done I simply close the VM and restore it to its original state, giving me a tidy little sandbox to play with again tomorrow. So if you are still living in the stone age with me and want to make this magic happen for you too, then give Virtual PC a try and you might be surprised how useful it is.
Obviously, the first thing to do is get the bits on your computer. You can grab a copy of Virtual PC 2007 here. Installation is simple and straight-forward, and once it is on installed you can follow these steps to create your first virtual machine.
Next, ensure your new Virtual Machine is easily maintainable. I like to start off with a fresh installation of the operating system and my development tools every time I turn the machine on (with minimal effort). The beautiful thing about Virtual PC 2007 is the ability to use the 'Undo Disks' feature. This feature saves any and all changes made while using the VM to a separate virtual hard disk. This leaves the main virtual hard disk in an unchanged state. To turn undo disks on, simply shut down the VM and click the 'Settings' button in the Virtual PC Console. Select 'Undo Disks' and click the 'Enable undo disks' checkbox.
When you start the VM, all new changes will be saved to a Virtual PC Undo Drive. As soon as you are done working in the VM, you will be prompted to either save the changes, merge the changes into the main virtual hard disk, or delete the changes and start with a fresh VM the next time you fire it up.
Isn't that easy? I feel almost foolish posting to the world that this is all news to me. But hey, we all have to learn this stuff somewhere and we shouldn't take for granted some of the simple things we know. What we assume to be old news may actually be the most novel idea to someone else.
I want to close by explaining why I am using Virtual PC instead of Virtual Server. For starters, Virtual PC is just a simpler tool. Besides that fact, Virtual Server was built and is intended for a different kind of use. While Virtual PC is a great tool for running legacy desktop applications, desktop application development and testing, training, and setting up many desktop scenarios, Virtual Server is made for server application development and testing, application migration, and server consolidation. You can read more about the differences between the two products here.
Subscribe to be the first to get our expert-written articles and tutorials for developers!