Blog

Double clicking on a VHD to mount it

Virtual PC Guy’s WebLog : Double clicking on a VHD to mount it
Double clicking on a VHD to mount it
Virtual Server 2005 R2 SP1 Beta 2 includes ‘vhdmount’ - a tool to allow you to mount a virtual hard disk directly on your host operating system. While vhdmount is provided as a command line tool - a very small amount of work will allow you to mount VHDs by just double clicking on them. By creating a .reg file with the following contents:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HD]
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshell]
@=”Mount”
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellDismount]
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellDismountcommand]
@=”"C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe” /u “%1″”
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellMount]
[HKEY_LOCAL_MACHINESOFTWAREClassesVirtual.Machine.HDshellMountcommand]
@=”"C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe” /p “%1″”
[HKEY_CLASSES_ROOT.vhd]
@=”Virtual.Machine.HD”
And then double clicking on the .reg file (to load it into your registry) you will be able to double click a VHD to mount it, and right click on it to dismount it.
Cool…

One Response to “Double clicking on a VHD to mount it”

  1. AlexJ Says:

    Hi,

    with Hyper-V Server there are an additional swith is required to dismount: /c ommit or /d iscard
    So the working reg file for using with Hyper-V Server is:

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell]
    @=”Mount”

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Discard]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Discard\command]
    @=”\”C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\” /d /u \”%1\”"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Commit]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount - Commit\command]
    @=”\”C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\” /c /u \”%1\”"

    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Mount]
    [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Mount\command]
    @=”\”C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\” /p \”%1\”"

    [HKEY_CLASSES_ROOT\.vhd]
    @=”Virtual.Machine.HD”

    Happy mounting…
    Alex

Leave a Reply