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.

  • ashwin

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

  • Ahmed Ehteham Zaedi

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

  • CognitivePainkiller

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

    Gr33tz, CognitivePainkiller.

    • Anonymous

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

  • Anonymous

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

  • uno

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

    • Anonymous

      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.

  • Anonymous

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

  • Anonymous

    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?

  • http://www.tech-recipes.com/ Rob Rogers

    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.