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

Filed under: Resources, Scripting, Server 2008 R2, Windows


Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.