Resources, Scripting, Server 2008 R2, Windows
comments 4

Right click to mount/unmount VHD in Windows 7 or Windows Server 2008 R2

Okay…this is not “yet another update” kinda post. If you thought that way, read the subject again. I had previously posted a tool to mount/unmount VHDs on a Windows Server 2008 system with Hyper-V and it works only if you have Hyper-V role enabled on the system because of its dependency on Hyper-V WMI interfaces.

Now, in this post, I am posting a new tool to mount / unmount VHDs by right clicking on a VHD file. This new tool will work on Windows 7 or Windows Server 2008 R2 systems with or without Hyper-V role. This one uses diskpart commands available within this new OS and hence there is no dependency on Hyper-V WMI interfaces. So, you can use this new script only if your system has Windows 7 or Windows Server 2008 R2. Windows Server 2008 R2 provides a way to mount / unmount VHDs from the disk management MMC. But, It takes too many clicks to do that :) and I prefer saving some clicks for more useful stuff.

To get the ability to mount / unmount VHDs using the right click context menu ( or what ever it is called), do the following

1. Download the zip file from here

2. Unzip the contents to C:\scripts or where ever you want

3. If you are unzipping the contents to a place other than C:\Scripts, you need to open vhd.reg in a notepad and update the path to VHDMount.cmd (Lines 14 & 19). Othewise, just skip this step and go to 4

4. Double click on the vhd.reg file. This will create registry entries required for the .VHD context menu

5. You are done. Enjoy…!!!

You will now see an option to Attach/detach VHDs by right clicking on them

  • hd

    Thank you very much.
    It works perfect !


  • Shawn

    In Windows 2008 x64 it says “Microsoft DiskPart version 6.06002

    DISK – Shift the focus to a disk.
    PARTITION – Shift the focus to a partition.
    VOLUME – Shift the focus to a volume.
    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.

    and then nothing happens even though it says it mounted successfully.

  • ravikanthchaganti

    Windows Server 2008 has no native support for VHD. So, you wont be able to mount the VHD in Windows 2008 x64. You need either Windows 7 or R2

  • SEO Agentur

    thanks a lot for these useful scripts ; )