Last time, I wrote a walkthrough of installing Virtual PC and XP Mode under the Windows 7 RC. If all you want to do is get XPM up and running, and maybe play with one or two basic VMs, you should be away to the races. But if you’re a more advanced user, you’re going to have a hell of a time finding certain basic settings and functionality. I’m going to show you where you can find most of these settings.
First, it’s important to understand the general architecture of the new Virtual PC. Before, it was pretty simple. You started Virtual PC, which gave you a small window with a list of registered Virtual PCs. It included controls to create, edit, and manage virtual PCs, as well as access to general program options and virtual disk tools. Each running VM had its own window. Simple.
Under Windows 7, things have been completely revamped. I’m guessing this was done to make virtualization feel like part of the OS rather than a stand-alone program. Unfortunately, it has had the effect of taking a nice, simple, centralized virtualization solution and scattering it all over the place. Now, each VM runs in its own process, and there are additional stand-alone applications for performing various management tasks. And to tie everything together, there’s shell integration – although this is currently woefully inadequate. So, to get you started with this new architecture, I’m going to describe how it all fits together, and then I’m going to show you a few commands to help you find some of the features you might be missing.
The ‘core’ of Virtual PC under Windows 7 from a UI perspective is the Virtual Machines folder. This will be found under your home folder (such as C:\Users\<Username>\Virtual Machines), and you should see a link to it on your Start Menu. Consider this a replacement for the Virtual PC Console of days gone by. You’ll see an entry for each known VM, and although it’s a standard Windows Explorer folder, you’ll see details on the machine’s status, memory, disk, and so on:
Right-clicking an entry exposes a ‘Settings’ command which lets you configure the VM:
What’s actually happening here? Well, the Virtual Machines folder is a list of .vmcx files, which are actually just shortcuts to .vmc files. These .vmc files haven’t changed; they still contain the definition and settings of the VM in question. By default, Windows 7 places the .vmc files under the hidden AppData folder, but they can be anywhere. In fact, if you open a .vmc file you have saved elsewhere, Windows will automatically create the .vmcx shortcut under the Virtual Machines folder for you. Deleting an entry from this window will NOT remove the VM, just like deleting a shortcut to a file won’t delete the target file itself.
VMWindow.exe: So, if the Virtual Machines folder is just a list of shortcuts displayed in Explorer, what happens when you start a VM? Actually, this is simple. Under Windows 7, .vmc (and .vmcx) files are associated with a program called VMWindow.exe, just like .txt files are associated with Notepad.exe. This is the process that the VM actually runs under. Technically, there’s a bit more wizardry going on here, involving services and the vpc.exe process, but let’s ignore that for now, it’s not really relevent for management purposes.
VPCSettings.exe: What about editing the settings of a VM? Well, that’s what this standalone application does. Each time you edit a VM’s settings (by right-clicking it under Virtual Machines and choosing Settings), this application is launched. Of course, you can still just edit the XML of the .vmc file if you really know what you’re doing.
VPCWizard.exe: Finally, there’s this little application, used for creating new VMs, as well as managing disks of existing VMs. When you click “Create virtual machine” on the Virtual Machines toolbar, this is what’s launched. It’s also used when you click Create or Modify under the Hard Disk portion of a VM’s Settings window.
VMCPropertyHandler.dll: Here’s another file you should be aware of. This isn’t a standalone executable, but it is responsible for some magic, including making Explorer understand details like Machine Status and Memory for .vmcx files. It also handles the launching of seamless applications, as we’ll soon see.
So, how can you use all this? Well, here are some tricks:
|To do this:||Run this command:|
|Launch an existing VM||VMWindow.exe –file <vpcfile>|
|Open the Virtual Machines folder||VMWindow.exe|
|Edit a VM’s settings||VPCSettings.exe <vpcfile>|
|Start the wizard for creating new VMs||VPCWizard.exe|
|Edit an existing .VHD hard drive image||VPCWizard.exe /type evhd /filepath <vhdfile>|
|Create a new .VHD image||VPCWizard.exe /type vhd|
There’s one other trick you might want to play with: launching seamless applications. However, I don’t really recommend you do this any way than through the built-in UI; it’s just too complicated and fragile. But, to launch a seamless application, you just need to call the LaunchVMSal function of VMCPropertyHandler.dll. You can do this through rundll32.exe. For example, here’s the command used to start IE6 in seamless mode on the Windows 7 desktop as shown in my earlier post:
rundll32.exe VMCPropertyHandler.dll,LaunchVMSal "Virtual Windows XP" "||c0a9b641" "Internet Explorer"
If it breaks, don’t say I didn’t warn you. If anyone knows what the weird hex code is for, please let me know.
So, hopefully this helps you understand how the new Virtual PC works a bit better. Clearly, Microsoft has a lot of work to do before this product is ready for launch, but I must say, I do like the direction they’re taking.
UPDATE: It looks like the ‘weird hex code’ I mentioned actually corresponds to a key under HKLM\Software\Microsoft\Windows NT\CurrentVersion\Terminal Server\TsAppAllowList. Virutal Windows XP uses Remove Desktop Services to expose XP applications to Windows 7, which means there’s a fully-documented API (and a WMI provider) if you want more details. Thank you, anonymous tipster!