Main menu

SmartFeed by FeedBurner Subscribe to the site feed.


If you find the information here useful, then please consider a small donation, or linking to this site.

Recent Comments

Recent Tweets

  • RT @robmargel: http://tinyurl.com/y8tcrhr - Parental Controls in Windows 7 and Windows Vista ^MW practical advice for parents
  • Just caught up for a coffee with an old friend at Microsoft UK (we were grads together 15 years ago... now I feel /really/ old)
  • Grrr... I paid £5 to respond to an ad on preloved.co.uk and the advertiser didn't even respond. There's a site to avoid in future...
  • [blog] Safer Internet Day: Educating parents on Internet safety for their children http://bit.ly/c0s8Jt
  • European Safer Internet Day: ChildLine's advice on staying safe online - parents might want their kids to read this: http://bit.ly/92HY9C

Calendar

September 2007
M T W T F S S
« Aug   Oct »
 12
3456789
10111213141516
17181920212223
24252627282930

Archive

Mounting virtual hard disks in Windows Vista

Written by: Mark Wilson

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

[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]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Virtual.Machine.HD\shell\Dismount\command]
@="\"C:\\Program Files\\Script Elevation PowerToys\\elevate\" \"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /u /d \"%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\\Script Elevation PowerToys\\elevate\" \"C:\\Program Files\\Microsoft Virtual Server\\Vhdmount\\vhdmount.exe\" /p \"%1\""

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

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:

Comments

1

Comment from Ted Stam
Time: Saturday 29 September 2007, 10:44

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

Comment from Mark Wilson
Time: Sunday 30 September 2007, 14:28

Hi Ted – are you using the elevate PowerToy? If so, has someone locked down the registry in some way? HTH, Mark

3

Comment from Ted Stam
Time: Monday 1 October 2007, 0:55

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.

4

Comment from Mark Wilson
Time: Tuesday 2 October 2007, 22:30

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

5

Comment from Ted Stam
Time: Wednesday 3 October 2007, 0:59

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?

Write a comment

Please note the rules for comments and the privacy policy and data protection notice. I'm sorry but, because not everyone sticks to the rules, I've had to implement some spam prevention measures - if you're experiencing difficulties leaving a comment, please let me know.





The following XHTML tags may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>