How to Auto-Mount VHD or VHDX File at Startup in Windows 10, 8.1, & 7?

Would you like to know about auto mount VHD in Windows 10? Then this is the right place where you will find all the details about auto-mount VHD/VHDX drives.

An abstract computer is known as a Virtual Machine. This uses a physical device in order to extend the computer system’s versatility while still having as many external environment characteristics as possible. Like most hypervisors, Hyper-V uses files to define this abstract computer. Therefore, the objects that abstract the hard drive(s) of a physical machine is merely data. For Hyper-V, these files are always in VHDX format.

Know more about VHDX-

A semi-open file format is a VHDX attached with a virtual hard disk description. To avoid confusion with the old or previous VHD format, X refers to the name of the current specification. To allow others to write their own applications that handle VHD/VHDX files, Microsoft freely publishes this specification. But Microsoft the only one that is responsible for format control.

You can store any files, including documents, images, photos, boot files, and full OS installation, using either format (.vhdxor.vhd) for a virtual drive. The only difference between the two formats is that a.vhdx file supports a maximum size of 64 TB, features power failure resilience, and improves performance.

Why Windows Auto-mount VHD/VHDX?

For Windows 10 (as well as Windows 8 and 8.1 and Windows Server 2012 +), you can install a VHDX folder. This allows you to save data from a VHDX file if you have some kind of fatal problem with your original operating system.

Now, let us begin with the auto-mount procedure: You can also read- How to open VMDK in Windows 10

Method 1: Automatically mount VHD in Windows 10 and 8.1 using Computer Management

1. Open the path of VHD/VHDX file and by the below code, create a text file:

Auto mount vhdx file

Notice: The script is useful to mount the VHD / VHDX file, select the partition, and assign a letter to the specified drive.

2. Hit on Windows + X keys and choose Computer Management.

Automatic attach vhd in windows

3. Right-click on Task Scheduler under System Tools, and choose Create Task
OR
Under Actions Choose, create Task from the right-pane.

auto-mount vhd file in windows

4. Do the following in the Create Task window:

Within General tab:

  • Type task’s Name.
  • In the description box, type about the task in detail.
  • Next, choose “Run whether the user is logged on or not” and also “Run with highest privileges” option.
vhd auto mount in windows 10

Within Triggers Tab:

  • Choose the New button to set up a New Trigger.
  • Next, choose the “At Startup” in Begin the task box.
  • Choose “delay task for” and set time according to you, under Advanced Settings.

Within Actions Tab:

  • By clicking on the New button, create a new action.
  • Choose “Start a program” in Action tab then choose the Program/Script and in the Add arguments(optional) enter the following:

/s (followed by space) and write the complete path and name of the script
file (same text file created in step 4).

vhdx auto mount in windows 10

Within Conditions Tab:

  • Do uncheck on the “Stop if the computer switches to battery power” option.
  • Again do uncheck on the “Start the task only if the computer is on AC power” option.
  • Press on OK to create the task.

5. Move out from the Computer Management and restart your system to test the auto-mount method.

Method 2: Mount and Unmount(VHD/VHDX) by Command prompt

For all versions of Windows, including Windows 10 / 8 / 7 and Windows Server.

To auto-mount VHD Windows 7 follows the steps below:

Using Command Prompt-

  • Initially, in Administrator mode, open the Command Prompt.
  • Type diskpart, at the Command Prompt,  and click
  •  Enter to access the command-line disk partitioning utility.
  • You need to specify the location of your vhd/vhdx file, before mounting or unmounting virtual disk. Next, type the following command and press Enter: choose vdisk file=”[location of vhd]”
  • Now, you can mount or mount your VHD/VHDX file using the below commands:

Type attach vdisk to mount VHD/VHDX file and hit Enter. In your Disk Management, you can see a new virtual hard drive and Windows Explorer.

commonds to auto mount vhd file

Type detach vdisk, to unmount a virtual hard disk, and hit Enter.

Using PowerShell-

You can also mount and unmount VHD/VHDX file in Windows Server 2016 / 2012 / 2008, using the PowerShell cmdlet:

  1. As Administrator, open the PowerShell.
  2. You can run the Mount-VHD cmdlet, when the command-line window opens, to mount your vhd/vhdx file.
  3. Mount-VHD by following Path “[location of vhd]”
  4. Just run the Dismount-VHD cmdlet to unmount your virtual hard disk.
  5. Dismount-VHDby following Path “[location of vhd]”
  6. If an error message such as “Mount-VHD is not recognized as the name of a cmdlet“, occur then you need to add a feature to your server named as “Hyper-V Module for Windows PowerShell”.
Conclusion

We have explained all the possible manual ways to auto-mount VHD in Windows 10 and auto-mount VHD Windows 7 as well and for all other versions also. This method works successfully but if suddenly the VHD file gets corrupted due to any reason. Then you cannot able to unmount it, first, you have to recover the VHD file. Therefore, VHD Recovery Software helps in this situation to recover data from corrupted VHD files.