https://dannyda.com/2022/08/20/how-to-automatically-mount-vhd-or-vhdx-file-on-startup-in-microsoft-windows-10-windows-11

How to Automatically Mount VHD or VHDX File on Startup in Microsoft Windows 10/Windows 11

The Issue

  • Attached/Mounted virtual disk VHD/VHDX is not attached/mounted automatically on system startup
  • We want to mount/attach the virtual disk/VHD/VHDX in Microsoft Windows/Windows 10/Windows 11 automatically on system startup/boot-up

The Answer

Here is one simple method, we can use the system built-in feature which is Task Scheduler and powershell or command prompt/cmd/bat to help us to achieve the desired results.

1 Open Task Scheduler

1a Use Run window

1a.1 Launch “Run” Window by using Win + R key combination

1a.2 Type taskschd.msc, Press Enter key or OK button to open Task Scheduler

1b Use start menu

1b.1 Search Task Scheduler from start menu (Click on the start button or Start key on keyboard to open start menu)

1b.2 Click on Task Scheduler or Press enter key to start it

2 Navigate to Task Scheduler (Local) -> Task Scheduler Library

3 From right hand side, Click on Create Task…

4 Make sure we have a self explanatory task name in the Name field, Check Run whether user is logged on or not option, Configure for Windows 10, Check Run with highest privileges too if necessary (e.g. If having issue with mounting automatically)

5 In the Triggers tab, Click on New… button

Make sure we Select At startup for Begin the task, Check Delay task for and enter 20 or 30 or 40 seconds if we have Bitlocker enabled, Check Enabled, Click on OK button

6 For Action Select Start a program, Program/script Select powershell.exe, Add arguments (optional) Enter Mount-DiskImage - ImagePath "C:\test.vhdx"

Note: We can also use a .cmd or .bat or .ps1 script here as well, for more options to mount the disk, we can refer to this guide

7 Click on Conditions tab, make sure under the Power section, Uncheck Start the task only if the computer is on AC power, Click on OK button

8 Click on OK button again, Enter the password for the current account which should have the administrator rights or other username/password which is an administrator. Click on OK button again

Different ways to attach/detach/mount/unmount virtual disk (VHD/VHDX) in Microsoft Windows/Windows 10/Windows 11 etc.