Windows 7 Virtual PC Management

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:

image

  Right-clicking an entry exposes a ‘Settings’ command which lets you configure the VM:

image

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!

18 comments:

  1. Thanks - your blog on Windows 7 Virtual PC was very helpful.

    ReplyDelete
  2. The "the weird hex code" is a key under TSAppAllowList key on the guest machine. Open it using regedit on the guest machine and it will be obvious...

    ReplyDelete
  3. what should I have under HKLM\...\TsAppAllowList in order to be able to open the IE6 from the VM?

    ReplyDelete
  4. There is something very strange about VMWindow.exe because it doesn't seem to exist. The properties of the 'Windows Virtual PC' link has this target: '%SystemRoot%\system32\vmwindow.exe', but the file doesn't exist.

    Moreover if I start-run-vmwindow.exe the VM folder opens, however from cmd didn't found any way to do the same.

    What I want to do is to lunch a VM from the command line. Any idea how can this be done?

    ReplyDelete
  5. Hi,

    I am trying to auto-attach a specfic USB device in seamless mode,

    any suggestions?

    ReplyDelete
  6. Not yet, but we do have a little something that may interest you in the works. Stay tuned...

    ReplyDelete
  7. "Not yet, but we do have a little something that may interest you in the works. Stay tuned..."

    I'm dieing to get this functionality. Please tell me more...

    ReplyDelete
  8. Thank you for the hex code info!!

    I was able to browse the registry of the virtual xp machine, open regedit, browse to the location mentioned above, and then find the proper hex code for the app I wanted to open seamless via win7.

    This is a great work-around for apps that don't appear in the "Windows XP Mode Applications" folder on the Win7 start menu.

    ReplyDelete
  9. Sorry for the long post. I hope someone can help.

    I have (had) apps running in Virtual XP mode under Win-7 Pro. Everthing was running fine until (for a different reason, at the suggestion of a MS Support tech) I "upgraded" my Win 7 with the original install disk. At least that where I think things stated going south.

    Now I cannot run the Apps anymore. I get a message saying: "problem starting C:\windows\system32\VMCPropertyHandler.dll The specified module could not be found" error. A search of the complete HD came up empty. This file is nowhere to be found. I can't even launch "Windows XP Mode" since this is no longer found under the "Windows Virtual PC" in Startmenu/All Programs.

    What should I do to fix this? Can I simply download VMCPropertyHandler.dll and copy it to the "system32" directory, or will I need to re-install Virtual PC and XP Mode? Will I need to re-install the apps?

    I tried downloading and re-installing Virtual PC, but the install program recognizes that Virtual PC is already installed and aborts the new install. Same thing also happens if I try to re-install "Win XP Mode".

    I also tried un-installing Win XP Mode and re-installing. This did not help.

    In Control Panel in the program list I see "Windows XP Mode", but I don't see any of the XP mode installed apps, (makes sense since I would need to enter XP mode to Un-install those apps). Also, I don't see "Virtual PC" under the program list, yet this was installed before XP Mode.
    Do I need to somehow un-install or reset (reboot) Virtual PC?

    ReplyDelete
  10. Good post Paul.

    Like Vlad asked, has anyone found the command line options to say, run the VM in fullscreen as you could do with previous versions of VPC?

    ReplyDelete
  11. Microsoft Virtual PC 2007 has to be unintalled before Windows Virtual PC can be installed

    You apps are installed on the VHD (hard drive file) of the virtual machine and should be safe

    I've had some problems just running virtual machines...I got a shortcut in the list of virtual machines (when u click on folder or actual program icon) and none of my machines would load. Deleting this shortcut re-enabled all my machines

    Ive had mysterious errors where the machine wont load but i just deleted it out of the folder view
    and added it again with create virtual machine and everything was fine (doesnt change your VHD file)

    Leaving ur machines in hibernation mode is the best option for continued running

    I recommend u delete the virtual machine out of the menu and use the create virtual machine to fix ur problems

    ReplyDelete
  12. alt - enter fullscreens

    any one know any other commands

    need to unstick mouse from the window (for old virtual machines) currently using the windows key on a non full screen windows to pop out the mouse

    ReplyDelete
  13. I cannot get my script to complete in Task Scheduler
    here is how I have it configured:

    Program/Script: C:\Windows\System32\VMWindow.exe
    add arguments: -file "C:\VirtualPC\Windows XP Mode.vmc"

    I have tried this and any other variation and I cannot get my virtual PC to start. What am I doing wrong?

    ReplyDelete
  14. The cause of my problem was checking the box "Run If User is Logged In Or Not" This was causing the virtual machine to not work with task scheduler.

    Once I selected "Run Only When User Is Logged In" would the virtual machine launch correctly

    HOWEVER
    now my issue is in Task Scheduler i cannot seem to END the virtual machine when I want to end it! When I end all tasks in task manager my virtual machine still remains open and active. How can I schedule a task that both STARTS my virtual XP and also ENDS it at a specific time.

    ReplyDelete
  15. My OS is Win-7 Pro. Everything was fine before but now...

    I get a "RunDLL" error saying VMCpropertyhandler.dll specified module cannot be found. Whenever I try to run an app in virtual XP Mode.

    Any ideas? Where can I get a copy of VMCpropertyhandler.dll?

    ReplyDelete
  16. Nate: Schedule a Task within the Virtual machine that either hibernates or shutdown.

    ReplyDelete
  17. Where can I get a copy of VMCpropertyhandler.dll?

    ReplyDelete
  18. Where can I download a copy of VMCpropertyhandler.dll?

    ReplyDelete


Copyright © 2010 Paul Guenette and Matthew Sleno.