Integrate VHD or VHDX file in Windows 10

The VHD file format is primarily used for virtual machines (Hyper-V) or for Windows backup. This file format stores all files of a virtual machine in an entire VHD or VHDX file. The VHDX file is the newer variant of the VHD and therefore a further development. Microsoft brings improvements to Hyper-V virtualization with every new version of Windows Server and then also partially adapts the VHD files.

Especially in the case of problems with a backup file or a defective VHD , it can make sense to look into the VHD or VHDX file . This is relatively easy with Windows board resources. Windows 10 provides everything you need. The command is DISKPART, which we have reported on several times. At the end of this article you will find further application examples of the DISKPART command .

Open VHD file with DISKPART

First you have to open a command prompt or a PowerShell console with administrator rights and call Diskpart.

The VHD or VHDX file now in the Windows system to integrate and to access it, you must your next carry. We have shown you this once below.

Integrate Diskpart VHD

The commands are in detail.

select vdisk file = “PATH AND FILENAME OF VHD (X) FILE”

Here you specify the exact path and the name of the VHD or VHDX file. In our example it is a VHDX file from a Hyper-V server based on Windows Server 2012 R2. It is important that the path is correct, otherwise an error message will appear.

attach vdisk

With “attach vdisk” you then carry out the actual integration of the VHD file. The successful integration of the VHD is indicated by the message “ DiskPart has successfully added the virtual disk file. ” approved. The VHD file is then available as a separate partition in Windows Explorer or at the command line level. You can now make changes to the content of the VHD, delete files and folders, create new ones, etc.

Remove the integrated VHD

When you are finished, you must then remove the integrated VHD file using the following DISKPART command.

detach vdisk

Diskpart confirms the removal of the VHD file with the message “ The file for virtual media was successfully disconnected from DiskPart. “.

You can find further possible uses for the DISKPART command in these articles.

Boot from external hard disk or make it bootable – Safely delete hard disk or USB stick with DISKPART
– How can write protection be activated or deactivated on a data medium
– Create LiteTouch PE x84 and x64 USB installation medium