How to: Easily mount VHDs by right clicking in Windows 7 (and Windows Server 2008)

VHDs are Virtual Hard Disks that are most commonly used as  hard drives for virtual machines. However, VHDs can also be mounted so they act like real hard drives; when mounted they appears to Windows as a real physical hard drive, and you can put files on, edit files on it, remove files on it, etc. Windows 7, and Windows Server 2008, have a new feature which allows users to mount VHDs without needing to use third party software.

While Windows 7 adds the ability to create and mount them natively (and theoretically ISO files as well), to do any of those actions you must use either DISKPART in command line or the Disk Management Console (DMC); and to use either you have to have Administrator rights.  Unfortunately, the only way to fix the Administrator rights problem is to turn off the UAC, a very bad idea.  However, there are ways to mount VHDs without using DISKPART or DMC. In this post, I am going to discuss two ways to do just that.

The first way is by using program called VHD Attach. All users have to do is install the program, and VHD Attach will add the the ability to “Attach” (mount) or “Detach” (demount) directly into the context menu (the menu that you get when you right click a file) for VHD files:

The cool thing about VHD Attach is once you run the installer, you need not (ever) run the program again. The context menu entries are done by editing the Windows registry and other geeky stuff so VHD Attach does not have to be running in order to use “Attach” and “Detach” from the context menu.

However, if you do want the run the program part of VHD Attach, you can use it to gain information about VHD files:


One *additional* feature VHD Attach adds is a “Detach” option on the context menu of real physical hard drives/partitions.

The second way is for the users who want more control over the whole process, or more options from the context menu, or just prefer not to download a program. Ben Armstrong, a Virtualization Program Manager at Microsoft, published on his blog “Virtual PC Guy’s Blog” a script that can do similar things as VHD Attach.  What makes his different and a bit more complex is that it uses DISKPART in the background, giving it more power.  Of course, “installing” the script is a bit more involved than running a simple EXE file. To install it run the code with the word install after it like “VHDBatch.cmd install”.  That will add the ability to mount, mount as read-only, demount, and compact the VHD.

My only complaint is that Ben Armstrong set the default double click action to mount as read-only, so if you’re like me and want it to mount it normally by default, you can download a version I modified.

You can download VHD Attach, Ben Armstrong’s script, and my modified version from the following links:

VHD Attach

Version reviewed: v1.00

Supported OS: Windows 7 and Windows 2008 Server R2

VHD Attach homepage [direct download]

Ben Armstrong’s Script

Version reviewed: Unknown

Supported OS: Windows 7 and Windows 2008 Server R2

Virtual PC Guy’s Blog homepage

[Direct download – Ben’s Script]

[Direct download – my modification of Ben’s script]

Related Posts