Mounting VHD files with VHDMount - Microsoft Virtual Server

Virtual Server 2005 R2 SP1 includes a tool called VHDmount that allows you to mount a virtual hard disk (which in fact is a .VHD file) directly on your host operating system. You can get Virtual Server R2 SP1 for free right here: “Virtual Server 2005 R2 SP1 now available“.
VHDMount is provided as a command line tool. You can perform various tasks by either running it directly from the Command Line, or by using simple batch files that do what you need to do. Some of the capabilities of VHDMount are:

/p – Plugs in the specified VHD as a virtual disk device without mounting the volume.

/m – Plugs in the specified VHD as a virtual disk device and mounts the volume.

/f – Performs the specified operation without creating an Undo Disk. This parameter is applicable for /p and /m. All changes to the mounted disk are directly written to the specified VHD.

Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts. Our next episode, “Polaris Inc., and Microsoft Teams- Reinventing how we work and play” will be airing on Oct. 28th from 10-11am PST.

/u – Unplugs the virtual disk device for the specified VHDFileName.

/c – Updates the original VHD with all changes that were stored in the Undo Disk anddeletes the Undo Disk after unplugging the disk. This parameter is only applicable if the VHD was mounted without using /f.

/d – Discards all changes to the mounted disk and deletes the Undo Disk after unplugging the disk. This parameter is only applicable if the VHD was mounted without using /f.

/q – Displays the disk name of the mounted virtual disk device for the specified VHDFileName.

VHDFileName – VHD name including full path.

DriveLetter – Optional parameter for /m option. If drive letter is specified the volumes are mounted starting at the specified drive letter. If drive letter is not specifiedit is automatically assigned.

All – Applies the operation on all mounted virtual disk devices. This parameter is applicable for /u and /q.

By default, VHDMount creates an Undo Disk in current users temporary folder. All changes to the mounted disk are written to this Undo Disk. Use /c to commit or /d to discard these changes at the time of unplugging the disk device. Use /f option to mount a VHD without an Undo Disk.

VHDMOUNT /p [/f] VHDFileName
VHDMOUNT /m [/f] VHDFileName [DriveLetter]
VHDMOUNT /u [/c | /d] VHDFileName | All
VHDMOUNT /q VHDFileName | All

Integrating VHDMount in the Explorer context menu

Ben Armstrong, a Program manager on the core virtualization team at Microsoft, has published a neat registry trick that allows 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 




@="\"C:\Program Files\Microsoft Virtual Server\Vhdmount\vhdmount.exe\" /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"

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

Windows will auto-install the correct driver and allow you to see the .VHD file as a new hard drive.

Issues with Windows Vista

Two notes about using this trick with Windows Vista:

  1. For some reason double click does not work in Windows Vista. The only way around it is to right-click on the .VHD file and select “Plug in”.
  2. VHDMount needs to run As Administrator. You can either disable UAC (read my “Disable UAC in Vista” article), or, to get this to work with UAC enabled, you will need to configure VHDMount.exe, go to the Compatibility Mode tab, and check “Run this program as an administrator”.

When youre done working with the mounted .VHD file you can right-click it and either choose to commit changes, or not.

Get the functionality of VHDMount without installing Virtual Server

If you need VHDMount but you don’t need or want to install Virtual Server you can install only the VHDMount components, use the Custom option in the Virtual Server R2 SP1 installer and clear all components except VHDMount.

Got a question? Post it on our Virtual Server & Virtual PC Forum!

Related Topics:

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: