Windows XP/Vista: How to Attach a VHD File

Posted November 12, 2008 by Rob Rogers in Microsoft Vista

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.