This tutorial will show you how to create an elevated task to automatically mount a VHD or VHDX file at startup for all users in Windows 10 and Windows 11.
Virtual hard disks (VHDs) are disk image file formats that have similar functionalities to a physical hard drive and are designed primarily for use with Hyper-V virtual machines.
When you attach a .vhd or .vhdx file, it will be mounted as a drive in File Explorer > This PC to open and access.
When you sign out, mounted VHD or VHDX files will not get unmounted, and will still be mounted and available the next time you sign in.
If you restart the computer, all mounted VHD or VHDX files will automatically get unmounted for all accounts.
If wanted, you can create an elevated task to automatically mount a VHD or VHDX file at startup instead of having to manually mount the VHD or VHDX file each time.
You must be signed in as an administrator to create an elevated task.
EXAMPLE: VHD or VHDX file mounted as drive in File Explorer
Here's How:
1 Open Task Scheduler (taskschd.msc).
2 Click/tap on Task Scheduler Library in the left pane of Task Scheduler, and click/tap on Create Task in the right Actions pane. (see screenshot below)
3 In the General tab, type a name (ex: "Mount VHD at Startup") you want for this task. (see screenshot below)
4 In the General tab, type a description (ex: "D:\VHD Example.vhdx") you want for this task. (see screenshot below)
I like to use the full path of the VHD or VDHX file as a quick reference of which file the task is mounting.
5 In the General tab, select (dot) the Run whether user is logged on or not box. (see screenshot below)
6 In the General tab, check the Run with highest privileges box. (see screenshot below)
7 In the General tab, select Windows 10 in the Configure for drop down menu. (see screenshot below)
8 Click/tap on the Triggers tab, and click/tap on the New button. (see screenshot below)
9 Select At startup in the Begin the task drop down menu, and click/tap on OK. (see screenshot below)
If you would like to delay this task from running at startup for a bit before prompting for the BitLocker password to unlock the drive, you can check the Delay task for box, and select how long of a delay you want after startup before this task automatically runs.
10 Click/tap on the Actions tab, and click/tap on the New button. (see screenshot below)
11 Type PowerShell in the Program/script field. (see screenshot below)
12 Type the command below into the Add arguments field, and click/tap on OK. (see screenshot below)
"Mount-DiskImage -ImagePath 'Full path of VHD or VHDX file'"Substitute Full path of VHD or VHDX file in the command above with the actual full path of the VHD or VHDX file you want automatically mounted at startup.
For example: "Mount-DiskImage -ImagePath 'D:\VHD Example.vhdx'"
13 Verify the details are correct for the command and full path of the VHD or VHDX file. (see screenshot below)
If it is not correct, click/tap on Edit, go back to step 12, and correct it.
14 Click/tap on the Conditions tab, uncheck the Start the task only if the computer is on AC power box, and click/tap on OK. (see screenshot below)
15 When prompted, enter the password of your Windows account, and click/tap on OK. (see screenshot below)
16 You will now see this new task (ex: "Mount VHD at Startup") listed in the Task Scheduler Library. You can now close Task Scheduler if you like. (see screenshots below)
You can Disable and Enable this task as needed.
You can Delete this task to remove it.
That's it,
Shawn Brink











