Microsoft Virtual Server 2005 R2 with SP1 comes with the VHD Mount (vhdmount.exe) utility. With this command-line tool, mounting and dismounting a Microsoft Virtual Hard Disk (VHD) image is easy.
If you’ve joined the virtualization revolution, there are times when you might need to quickly mount a Microsoft Virtual Hard Disk (VHD) image to see its contents, just like any ordinary hard disk. If you’re running Microsoft Virtual Server 2005 R2 with SP1, you already have a utility you can use: VHD Mount (vhdmount.exe).
VHD Mount comes installed in the C:\Program Files\Microsoft Virtual Server\Vhdmount folder. You can use this tool from the command line; the commands are pretty straightforward. To mount an image, follow the syntax
vhdmount.exe /m vhd_path drive
where vhd_path is the path to the .vhd file you want to mount and drive is the drive letter to which you want to assign the image. You need to specify the colon after the drive letter (e.g., F:).
By default, VHD Mount creates an undo disk for each mounted image, just like Microsoft Virtual PC and Virtual Server do. If you want to override this behavior and write directly to the mounted image, you can add the /f switch:
vhdmount.exe /m vhd_path drive /f
To dismount an image, you have two options. If you want to save any changes you’ve made to the VHD before dismounting, follow the syntax:
vhdmount.exe /u /c vhd_path
If you don’t want to save any changes you’ve made to the VHD before dismounting, use this syntax instead:
vhdmount.exe /u /d vhd_path
Note that you need administrative rights to run VHD Mount.