Double clicking on a VHD to mount it (take 2)

A while ago I posted about setting this up with Virtual Server 2005 R2 SP1 Beta 2 - but things have changed since then.  If you want to be able to double click on a virtual hard disk to mount it - after you have installed Virtual Server - create a plain text file, change its extension to '.reg' and put the following text inside:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HD]
@="Virtual Hard Disk"

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshell]
@="Plug in"

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellPlug in]
@="&Plug in"

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellPlug incommand]
@=""C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe" /p "%1""

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellUnplug (discard changes)]
@="Unplug (&discard changes)"

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellUnplug (discard changes)command]
@=""C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe" /u /d "%1""

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellUnplug (commit changes)]
@="Unplug (&commit changes)"

[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellUnplug (commit changes)command]
@=""C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe" /u /c "%1""

[HKEY_CLASSES_ROOT.vhd]
@="Virtual.Machine.HD"

Double click on the .reg file and you will be ready to go.  You can now double click on a .VHD file to mount it - and right click on it to select to dismount it.

(N.B. You will need to change the path for vhdmount.exe if you did not install to the default location on C:.)

Two notes about using this with Windows Vista:

  1. For some reason 'double click' does not work.  Right clicking and selecting "Plug in" works - but not double clicking.  If anyone knows why this is - please let me know.
  2. VHDMount needs to run 'As Administrator'.  To get this to work with UAC you will need to browse to vhdmount.exe, right click on it, select Properties, change to the Compatibility tab and check Run this program as an administrator.  Now it will work just fine.

Cheers,
Ben