Share via


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...

Cheers,
Ben

Comments

  • Anonymous
    September 02, 2006
    Awesome tip, thanks a lot

  • Anonymous
    September 02, 2006
    Very Nice.

  • Anonymous
    September 03, 2006
    I want to customize the Microsoft virtual server, what i want is the admin gui page it shows I want to customize that like I want to create 4 VirtualMachine at a time by running a VB script ,can u provide that script to me which take input  for creating many VMs at atime.

    please provide me the script. thanks
    mithu_manoj@yahoo.com

  • Anonymous
    September 04, 2006
    Hi,
    how is it possible to use vhdmount with WinXP SP2?

  • Anonymous
    September 27, 2006
    Very nice, this. Look forward to drv being signed

  • Anonymous
    July 05, 2010
    what area of a windows 7 reg is this file to go into? That is, will it work within windows 7?

  • Anonymous
    July 10, 2011
    Just for the record, windows 7 can natevily add (and create) VHD disks. You can do this going to Start -> right click on Computer -> Manage. When the Computer management window opens select Disk management and wait a second. Afterwords go to Action -> Attach VHD. Thats it.

  • Anonymous
    April 23, 2012
    You had better change "C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe" /p "%1" to "C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe" /p /f "%1" or sometimes you can't dismount the VHD while you just take a look at that VHD and didn't write anything to it.

  • Anonymous
    December 03, 2012
    For dismount, you need to specify is this is with discard or commit.  I suspect you'd want commit.  In that case the switches should be "/u /c".  For discard, they would be "/u /d".

  • Anonymous
    April 27, 2014
    Important note : When nothing happens upon mounting/unmounting the VHD, goto C:Program FilesMicrosoft Virtual ServerVhdmount, and change the vhdmount.exe properties to run as administrator (right click vhdmount.exe , choose compatibility tab and select Run as administrator).