DEV Community

Awaliyatul Hikmah
Awaliyatul Hikmah

Posted on

How to Automounting Your VHDX on Windows 11 Without Mount-DiskImage Command

If your Windows doesn't support the Mount-DiskImage -ImagePath command, follow these steps to automount your VHDX file.

Create The Script

  1. Open Notepad and create a new file. Add this script:
select vdisk file="<path_to_your_vdhx_file>"
attach vdisk
Enter fullscreen mode Exit fullscreen mode
  • Example:
select vdisk file="D:\MyVirtualDisk.vhdx"
attach vdisk
Enter fullscreen mode Exit fullscreen mode

Save the file as .txt file

Create New Task Scheduler

  1. Click the Windows Button and search for Task Scheduler
    Klik Windows Button, Search Task Scheduler

  2. Look at the Action Panel on the right side, or click Action on Status Bar, then click Create Task
    Create Task

  3. Fill in the Name field (it's up to you), Choose Run whether user is logged on or not, and check Run with highest privileges too
    Fill the form

  4. Go to Trigger tab, then click New
    Add new trigger

  5. Choose At startup for Begin the task, and Check Enabled
    Config trigger

  6. Go to Action tab, then click New

    • Choose Start a program for Action field.
    • Type powershell.exe for Program/script
    • Add arguments diskpart /s "<your_txt_script_path_you_created_in_the_first_step>" (e.g., diskpart /s "D:\script.txt")
    • Click OK Config action
  7. Go to Conditions tab, make sure to uncheck Start the task only if the computer is on AC power, then click OK.
    Config condition

  8. Enter your password, then click OK
    Input password

Top comments (2)

Collapse
 
scsoi profile image
疏影 •

Solid PowerShell approach. The modern alternative: if you don't actually need a full NTFS volume (e.g. you just want a drive letter backed by cloud storage), ScsDriver (USD 9.99/year) does it without VHDX — works on Windows Server / Win 11, auto-mounts at login, and survives reboots cleanly.

Collapse
 
scsoi profile image
疏影 •

VHDX auto-mount is a useful trick — gives you a real NTFS filesystem that survives reboots without consuming real disk space beyond what you put in the VHDX. Three patterns I keep returning to:

  • For 'I just want a folder' use cases: NTFS sparse VHDX is fine. For 'I want a working copy of a network share' use cases: skip the VHDX and mount the network share directly — ScsDriver covers SMB / S3 / Blob / SFTP / WebDAV in one mount table, and the VHDX indirection layer just gets in the way.
  • Schedule a quarterly check that the auto-mount is still firing — Windows updates occasionally reset scheduled tasks. The 'why is my drive letter gone' complaint has a recurring monthly cycle.
  • If you sync the VHDX to a NAS or S3 (one common use case), make sure to dismount before sync. Mounted VHDX being snapshotted is the recipe for corrupted copies. Operational note: VHDX files larger than 2TB require GPT. Don't accidentally create an MBR-partitioned VHDX and discover it at 4TB.