Using Virtual PC as a Test and Learning Platform
In my previous article on WindowsNetworking.com I summarized some of the ways you can get the best performance out of Virtual PC. Once you’ve mastered these steps, you’re ready to put the platform to work, and one of the most common uses of Virtual PC is using it for software testing and learning purposes. Here are eight possible scenarios you might use Virtual PC for these purposes:
Testing and Learning Scenarios
1. Create testbed networks. Only have one spare PC to play around with? Providing it’s a powerful one with a fast processor, tons of RAM, and lots of disk space, you can create an entire test network of virtual machines on your PC and try out various scenarios. For example, you could have one VM running IIS6 on Windows Server 2003 with an ASP.NET application installed that connects to another machine running SQL Server 2000 that hosts the back-end database for your application. Then you can start a third VM that runs Windows XP and use it as a client machine to connect to your web server and access your database. Front-end client machine, mid-tier web application server, and back-end database server, all running within a virtual network on Virtual PC. The possibilities are endless!
2. Mirror production networks. Before you deploy a patch (such as a service pack or hotfix) on a production network, you should test it first to make sure installing it doesn’t impact applications running on your network. Of course, to test patches properly you should do it on a test network that mirrors your production network as closely as possible. In the past that could mean needing a half dozen or so machines running different operating systems, services, and applications all connected on a network isolated from your production network. But with Virtual PC you only need one machine—you create a virtual network of half a dozen VMs that mirror actual servers and clients on your production network. Then you apply the patch on your virtual network and test to see what happens.
3. Learn how stuff works. Say you want to study how Active Directory replication works. To do this, you could create a virtual network with three domain controllers in two different sites, and use replmon to study how intra-site replication works compared with inter-site. Or you could install SharePoint Portal Server 2003 on one virtual machine and Microsoft Office on another, and learn how SharePoint Portal Server can act as a back-end for Office. Again, the possibilities are endless using Virtual PC as a learning platform. You can even set up Remote Installation Services (RIS) and learn how to work with it, though there are some limitations on how RIS deployment works in a virtual machine environment.
4. Try risky things. Ever wanted to see what happens when a certain virus, worm or Trojan infects a Windows operating system? Create a VM to host that OS as guest and then deliberately infect the VM and see what happens. Provided you’ve created an undo disk for your VM, you can go ahead and do anything you want with it and still be able to have it ready to use another day. Other risky things you could try might include trying to wreck Active Directory by messing with the schema, corrupting the IIS metabase by editing it improperly, pretending you’re a hacker and running a malicious script, and so on. What fun!
5. Application testing and debugging. Instead of testing applications you’re developing on your production desktop, install Virtual PC on it and test those applications within a sandbox environment that protects your production network from the problems associated with buggy software. I haven’t tried this one myself, but I’ve heard you can actually connect one VM as a debugger to another VM so you can debug software issues at low level. Doing this involves setting up a named pipe connection (essentially a virtual serial port) which takes the place of the serial cable you normally use to connect a dev machine to a debugger (see this post in Angus Logan’s blog for more).
6. Beta testing. If you love staying ahead of the technology curve by beta testing new software (either because you’re a technology addict or your business requires that you be knowledgeable in such things) then Virtual PC can be a benefit here also. Instead of needing a separate machine for each product you test (or multiple machines if the beta is for a product that requires multiple boxes to implement) you can do all your beta testing on a single machine running Virtual PC—provided you can install the beta product as a virtual machine. If you’re on the Vista (formerly Longhorn) beta program, then you can find some tips on installing Vista Beta 1 on Virtual PC in this entry of Robert Moir’s blog.
7. Training staff. You also can use Virtual PC to train staff in how different software products work. For example, you could create a VM with Microsoft Office installed and have new employees work through various procedures to learn how to use certain Office features your company frequently uses. Then with undo disks enabled, when the employee has finished their training they shut down the VM and the changes they made are lost and the VM is ready for the next employee to work with. Microsoft has developed whole series of VM-based labs called Microsoft Virtual Labs to help IT professionals and developers become familiar with Microsoft products.
8. Doing demos. Say you’re developing an ASP.NET app for a company and you want to demo your app at your next meeting with them. Create a virtual testbed network with clients and servers and your app installed, copy the VMs to your laptop, and show them how the app will actually work in a demo virtual machine environment. Much more effective than saying “If we had a web server then clicking here would do this” and so on.
Testing and Learning Tips and Suggestions
If you’re going to use Virtual PC (or Virtual Server) for any of the testing and learning scenarios discussed above, then here are some tips that can make your life easier:
- You’ll need software for testing purposes. Getting an MSDN subscription can be an excellent resource in this regard, providing you can afford it (if you’re buying it personally) or justify it from a business point of view (if you want your employer to purchase it).
- The general rule of thumb concerning licensing when installing software on Virtual PC is that a virtual machine has the same licensing requirements as a physical machine. Be sure to check your vendor’s website for specific exemptions to this however. The Virtual Server 2005 Frequently Asked Questions page on Microsoft’s website has some good information (plus a whitepaper you can download) concerning licensing Microsoft products in a virtual machine environment.
- Make sure you understand the various ways virtual machines can be networked together under Virtual PC. You can network things so your guest machines can only see each other and not the host machine, or you can network things so your guest machines can’t see each other but can see the host machine, or you can network things so your guest machines can see each other and the host machine and the outside network and so on. A good summary of the different Virtual PC networking options can be found in KB 833134 on TechNet, and I advise you to play around with these different scenarios and become familiar with them.
- In connection with the previous point, one thing you should remember is that your virtual machines are just as susceptible to viruses, worms, and hacking attacks as your real machines. So if your guest OSes are accessible over your physical network (and hence from the Internet) then you need to ensure that you’re guest OSes are fully patched, have their firewalls enabled, have antivirus software installed, and so on. Otherwise a VM might get infected and then infect your whole production network, yikes!
- If you’re going to use virtualization a lot for testing or development purposes, a good idea is to create a library of sysprepped images of different OS platforms. A good resource on how to sysprep virtual machines can be found here in Megan Davis’s blog. Once you’ve sysprepped an OS, you can use differencing disks to create multiple different VMs from the same base image. And of course, use undo disks liberally as well so you won’t have to recreate VMs you’ve messed up through your testing.
When You’ll Need Virtual Server Instead
For certain testing scenarios, Virtual PC unfortunately just isn’t enough. For example, if you want to test Windows Server 2003 server clustering, you’ll need to use Virtual Server instead of Virtual PC. That’s because Virtual Server supports virtual SCSI drives (Virtual PC doesn’t support this) and server clustering requires a shared SCSI drive (shared IDE isn’t supported). Interestingly, I did read somewhere that someone managed to get server clustering working under Virtual PC by creating a shared iSCSI drive, and if anyone tracks down that reference please email me as I’ve lost it, thanks!
Note also that Virtual PC doesn’t support symmetric multiprocessing (SMP) so there’s no point using an SMP machine running Virtual PC as your test box. And while Virtual Server does run on SMP machines, each VM within Virtual Server can only see one CPU at a time. This means unfortunately that you can’t use VMs to test things like processor affinity in IIS6, even if you’re running Virtual Server instead of Virtual PC.
Also, if you want to use virtualization to test patches before installing them on production networks, you can use the Virtual Server Migration Toolkit (VSMT) from Microsoft to migrate a physical machine to a virtual machine. VSMT is thus a terrific tool for mirroring your production network to a virtual network, but unfortunately it only works with Virtual Server and not with Virtual PC.
As you can see from the above, Virtual PC is indeed a terrific tool for test purposes, though for some scenarios Virtual Server can be an even better choice. I’ll leave you with a few links to some useful resources on Virtual PC and Virtual Server where you can find additional tips, tricks and suggestions for how to make the most of these virtualization platforms:
- Robert Moir’s Virtual PC 2004 FAQ is an excellent source of tips and procedures.
- The Soul of a Virtual Machine, the blog of Megan Davis, technical writer at Microsoft, who frequently blogs the latest news about Microsoft virtualization technologies and some good tips (like how to sysprep) as well.
- Virtual PC Guy's WebLog, the blog of Ben Armstrong, a Program Manager on the Virtual Machine team at Microsoft, who likes playing older computer games—or at least getting them running under Virtual PC!
If you have questions about or problems running Virtual PC or Virtual Server, I suggest you post to the microsoft.public.virtualpc or microsoft.public.virtualserver newsgroups with your questions. Reason is, these newsgroups are haunted by Microsoft Most Valuable Professionals (MVPs) who know a lot about these products and are eager to help people with their problems. You can access these newsgroups in two ways:
- Use an NNTS newsreader like Outlook Express and point to nntp://msnews.microsoft.com
- Use the web-based newsreader accessed through the Microsoft Technical Communities website (you’ll find the Virtual PC newsgroup here and the Virtual Server one here)
Footnote Added Later
In this article I said "For certain testing scenarios, Virtual PC unfortunately just isn't enough. For example, if you want to test Windows Server 2003 server clustering, you'll need to use Virtual Server instead of Virtual PC. That's because Virtual Server supports virtual SCSI drives (Virtual PC doesn't support this) and server clustering requires a shared SCSI drive (shared IDE isn't supported). Interestingly, I did read somewhere that someone managed to get server clustering working under Virtual PC by creating a shared iSCSI drive, and if anyone tracks down that reference please email me as I've lost it, thanks!"
Well, a helpful WindowsNetworking.com reader named Robert Moreno found a reference on how to do this, see here. Thanks Robert!!