Windows XP/Vista: How to Attach a VHD File

If you wish to access the contents of a VHD file without having to run Virtual PC or Virtual Server, you can do so on Windows XP and Vista by installing only a component of Virtual Server and running a single command from the command line.

Download Virtual Server 2005 R2 and install as follows:

1. Continue through the installation process until you come to the Setup Type.

2. Select Custom from the two available setup types.

3. Click Next.

4. From Custom Setup, deselect all features to be installed EXCEPT VHD Mount.

5. Click Next.

6. Click Install.



To attach a vhd file:

1. Open Windows Explorer and browse to C:\Program Files\Microsoft Virtual Server.

2. Hold down the Shift key and right-click on the Vhdmount directory.

3. Select Open Command Window Here from the context menu.

4. At the resulting command prompt, input the following:

vhdmount /p /f [path to vhd file]

For example: vhdmount /p /f E:\VirtualXP\VirtualXP.vhd

Windows will install the driver and the vhd file will be added as a drive that you can access from Computer.



To detach a vhd file:

1. Open Windows Explorer and browse to C:\Program Files\Microsoft Virtual Server.

2. Hold down the Shift key and right-click on the Vhdmount directory.

3. Select Open Command Window Here from the context menu.

4. At the resulting command prompt, input the following:

vhdmount /u [path to vhd file]

For example: vhdmount /u E:\VirtualXP\VirtualXP.vhd

The virtual disk will be unplugged and will no longer be listed as a drive.

 

About Rob Rogers

Once a prolific author here on Tech-Recipes, Rob has moved on to greener pastures.
View more articles by Rob Rogers

The Conversation

Follow the reactions below and share your own thoughts.

10 Responses to “Windows XP/Vista: How to Attach a VHD File”

  1. December 01, 2008 at 6:48 am, ashwin said:

    thanks a lot for sharing the information… i will try…

    Reply

  2. April 27, 2009 at 4:53 pm, Ahmed Ehteham Zaedi said:

    What happens after that, meaning after attaching vhd drive how am i going to boot from the vhd drive.

    Reply

  3. June 18, 2009 at 2:05 pm, CognitivePainkiller said:

    Or without installation you may use:
    MMC
    and then using the Disk Management plugin.
    There you can attach every VHD you want.

    Gr33tz, CognitivePainkiller.

    Reply

    • October 11, 2009 at 12:31 am, Anonymous said:

      Is there any How To on doing this MMC as Cognitive Painkiller says???

      Reply

  4. July 16, 2009 at 10:26 pm, Anonymous said:

    Unfortunately this only apples to Win XP Pro and Vista — Not XP Home which is what I need it for. Damn, Damn, Damn!

    Reply

  5. October 12, 2009 at 10:10 pm, uno said:

    Does vhdmount work for Vista Home Premium or requires Ultimate/Business?

    Reply

    • November 18, 2009 at 2:27 am, Anonymous said:

      Vista Home Premium should have diskpart built in. Try “attach vdisk file=[PATH to VHD]” and it should attach it without a hitch and assign it a drive letter.

      Reply

  6. February 21, 2010 at 8:11 pm, Anonymous said:

    I’m have not an Open Command Window Here in context menu.Please,help me.
    Thank you.

    Reply

  7. March 04, 2010 at 1:08 pm, Anonymous said:

    I got as far as the command prompt window an typed in the path etc and it says “Access denied. Administrator permissions are needed to use the selected options. Use an elevated command prompt to complete these tasks.” I am the only user on the computer, am i not the administrator?

    Reply

  8. November 07, 2010 at 4:13 pm, Rob Rogers said:

    The UAC in Windows Vista and Windows 7 prevent you from running many commands in the command prompt when it is opened in the normal manner. This was put in place to prevent a virus or other evil script or program from executing harmful commands on your computer. It is a pain in the butt, however I can see why some people need this. Just right-click the command prompt shortcut and select run as administrator. You will have an elevated command prompt and can go ahead with your work. Sorry it took so long, I missed your comment for some reason.

    Reply

Leave a Reply