Mounting virtual hard disks in Windows Vista

Microsoft’s Virtual PC Guy (Ben Armstrong) wrote a blog post last year about using the VHDMount utility from Virtual Server 2005 R2 SP1 with a few registry edits to enable right-click mounting/dismounting of virtual hard disk (.VHD) files.

As .VHD files become ever more prevalent, this is a really useful capability (for example, Windows Vista’s Complete PC Backup functionality writes to a .VHD file).

The trouble is that, as supplied, Ben’s script does not work on Windows Vista as attempting to run vhdmount.exe will return:

Access Denied. Administrator permissions are needed to use the selected options. Use an elevated command prompt to complete these tasks.

An elevated command prompt is fine for entering commands directly (or by running a script) but what about Ben’s example of providing shell-integration to mount .VHDs from Explorer? Thankfully, as Steve Sinchak noted in TweakVista, Michael Murgolo wrote an article about elevating commands within scripts using a free PowerToy called elevate which is available from the Microsoft website. After downloading and extracting the elevate PowerToy scripts, I was able to confirm that they would let me run vhdmount.exe using the command elevate vhdmount.exe

Following that, I edited Ben Armstrong’s registry file to read:

Windows Registry Editor Version 5.00




@="\"C:\\Program Files\\Script Elevation PowerToys\\elevate\" \"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /u /d \"%1\""


@="\"C:\\Program Files\\Script Elevation PowerToys\\elevate\" \"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /p \"%1\""


Note the /d switch in the dismount command. I had to use this (or /c) to allow the disk to be unmounted and avoid the following message:

The specified Virtual Hard Disk (VHD) is plugged in using the default Undo Disk option. Use /c to commit or /d to discard the changes to the mounted disk.

I chose the discard option as most of my .VHDs mounting is simply to extract files but others may prefer to commit.

A few more points to note about VHDMount:

5 thoughts on “Mounting virtual hard disks in Windows Vista

  1. Hello,

    Running Vista and I can’t import your modified Ben Armstrong .reg file into the registry. I get an error “Cannot import vhdmount.reg. Error accessing the registry”.

    What am I doing wrong?

  2. Hi,

    I installed the Powertoys by extracting and installing the .inf files. However, the directory “C:\\Program Files\\Script Elevation PowerToys\\elevate\” that your file points to does not seem to exist. The elevate.cmd and elevate.vbs files exist only in my download directory where I extracted them. Is there a trick to installing this powertoy? Do I have to manually create this directory? This may very well be the problem.

  3. Hi Ted
    Sorry, I should have been clearer – C:\Program Files\Script Elevation PowerToys\elevate is the location that I extracted the PowerToys too (there is no installation process as such). You can edit the .reg file to use any path you like as long as you remember to use \\ instead of \ or alternatively you could extract the PowerToy files to the location that I used.

    Cheers, Mark

  4. Thanks Mark,
    I tried this without success. I think there’s something wrong with the permissions in my registry.

    For example, the key [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD]
    exists, but in regedit I cannot look at it. It says there is an error opening it and “access is denied”. I’m guessing I can’t import to a key like this?

Leave a Reply