Windows 8 and 8.1 Forums

VHD - Auto-mount at Startup in Windows 8

  1. #1
    VHD - Auto-mount at Startup in Windows 8

    VHD - Auto-mount at Startup in Windows 8
    How to Auto-mount a VHD at Startup in Windows 8
    Default VHD - Auto-mount at Startup in Windows 8

    Published by


    Join Date: Jan 2013
    Posts: 959

    How to Auto-mount a VHD at Startup in Windows 8

    information   Information
    This tutorial will help show you how to have a VHD auto-mount as a drive at startup in Windows 8.

    You must be signed in as an administrator to complete these steps.

    Tip   Tip
    If you like, you could also use Bitlocker to encrypt the VHD drive.

    Here's how...

    1. To start with, create a VHD file, using the drive letter you want to use for this VHD.
    NOTE: For example, I've created a VHD file called 'MySecureStuff.vhd' in the 'C:\MyVHDs' folder, and I want it to be mounted as drive H.

    2. Open Notepad, and copy the text below into it. (Note I have struck out the third line as I believe it was incorrect and shouldn't be entered.)

    select vdisk file="C:\MyVHDs\MySecureStuff.vhd"
    attach vdisk
    assign letter=H

    A) Change the 'file=' part of the first line to contain the full path to the VHD you created earlier in step 1.

    B) Change the 'assign letter' to be the drive letter you wish to use.

    Click image for larger version

    3. In Notepad, save it as a .txt file, and close Notepad.
    NOTE: For example, I've called mine 'AttachVHD_H.txt' and saved it in a folder called 'C:\MyVHDs\VHDLoadScripts'.

    Click image for larger version

    4. Open the WIN+X Power User Tasks menu, and click/tap on Computer Management. (see screenshot below)

    Name:  SetupScript_3.png
Views: 45875
Size:  8.1 KB

    5. In Computer Management, select Task Scheduler on the left (point 1 on screenshot), then select Create Task (point 2 on screenshot).

    Click image for larger version

    6. In the General tab, enter a name and description for your task. Change the radio buttons to 'Run whether user is logged on or not', and change 'Configure for:' to say Windows 8.

    Name:  Task_1a.png
Views: 45927
Size:  24.7 KB

    7. Select the Triggers tab, then click New to add a new Trigger. Change 'Begin the task' to say 'At Startup'. Optionally, you can also tick the 'Delay task for' checkbox and select 1 minute (see note below). Click on OK.

    Note   Note
    The reason I selected a 1 minute delay is because I plan to enable BitLocker. Delaying gives the computer the chance to prompt me to enter a Bitlocker password just after I login rather than having to manually find the drive and start BitLocker. If you aren't using BitLocker, I don't think there's any advantage in selecting the delay.

    Click image for larger version

    8. Select the Actions tab, then click New to add a new Action.

    A) In the 'Program/Script' box enter diskpart.

    B) In the 'Add arguments' box enter:


    followed by a space and then the full path and name of the script file saved in step 4. So in my example it is:

    /s C:\MyVHDs\VHDLoadScripts\AttachVHD_H.txt

    C) Click on OK.

    Click image for larger version

    9. Select the Conditions tab. Clear the two checkboxes to Stop if the computer switches to battery power and Start the task only if the computer is on AC power, then click on OK to create the task.

    Name:  Task_4a.png
Views: 46446
Size:  26.4 KB

    10. If a Task Scheduler dialog pops up, saying 'enter user account information for running this task' then enter the password for the administrator username.
    WARNING: You will also need to update this if you ever change the password on this account.

    Name:  Task_6a_Auth.png
Views: 45584
Size:  12.7 KB

    11. Close Computer Management.

    12. To test this works, restart your computer. When it restarts, you should find that after a minute, the new drive is mounted as drive H: (or whatever you selected).

    That's it, you're done!

  2. #1

    Posts : 21,859
    64-bit Windows 10

    Great tutorial David. It's all polished up now.

      My System SpecsSystem Spec

  3. #2

    Great job DavidY!
      My System SpecsSystem Spec

  4. #3

    Orbiting the Moon
    Posts : 2,972
    Windows 10 x64

    Great work!
    Can be very useful.
      My System SpecsSystem Spec

  5. #4

    Posts : 10
    Win 8.1

    I have tried this a couple of times and although it "mounts" the VHDX, I have to double-click the VHDX file in Explorer before it is visible as my H Drive. Any solution for this?
      My System SpecsSystem Spec

  6. #5

    Posts : 959
    Windows 8.1, 10

    I'm not sure, to be honest.

    When you initially created the VHD, did you assign it to drive H:? I found that I needed to assign the same drive letter in Disk Management as I wanted to mount it with later.

    Also what happens if you run the diskpart command in an elevated command prompt?

    One thing to try is to run this (with whatever filenames and paths you used).
    diskpart /s C:\MyVHDs\VHDLoadScripts\AttachVHD_H.txt

    Note that when I tried this, it gives me this message at the end. This doesn't seem to be an issue though.
    There is no volume specified.
    Please select a volume and try again.
    Or you could try the commands individually , eg.
    select vdisk file="C:\MyVHDs\MySecureStuff.vhd"
    attach vdisk
    assign letter=H
      My System SpecsSystem Spec

  7. #6

    Posts : 10
    Win 8.1

    Hi David - my physical HGST 4TB drive has drive letter E: assigned to it in Disk Management. Should the virtual drive have a different logical letter?

    Disk 1 in DM is the physical HGST 4TB drive with the first 379MB reserved by the system, the next 2TB in an active, healthy primary partition (listed as E, and the remaining 1.6TB unallocated.
      My System SpecsSystem Spec

  8. #7

    Posts : 959
    Windows 8.1, 10

    Hi bbrescia,

    Have you assigned a drive letter to the virtual disk VHDX, in Disk Management?

    In my example it's the Virtual drive letter I'm trying to set; what I did was create a VHDX and set it to drive H: when I first set it up in Disk Management.

    The diskpart script in Task Scheduler then mounts it back to where it was before, but I think it needs to be done in Disk Management first.

    There shouldn't be any changes to the physical drive letters.
      My System SpecsSystem Spec

  9. #8

    Posts : 10
    Win 8.1

    yes - sorry, I am saying H: but really I meant F:. The drive is assigned to F: in DM and my script says F: too. The task reports that it ran successfully.
      My System SpecsSystem Spec

  10. #9

    Posts : 10
    Win 8.1

    When I run my script from a DOS prompt, it reports successful completion but also says, "There is no volume specified. Please select a volume and try again."

    ALso - after the script runs, I can see that in DM, the virtual drive is mounted with the letter F: It also appears in Explorer. It just doesn't get to the final step of appearing in Explorer if the script runs at startup. Here is my script:

    select vdisk file="E:\HGST4TB.vhdx"
    attach vdisk
    assign letter=F
      My System SpecsSystem Spec

Page 1 of 7 123 ... LastLast
VHD - Auto-mount at Startup in Windows 8

Similar Threads
Tutorial Forum
BSOD Error On Startup - Auto Restarts
Hello, My little brothers desktop PC that is running Windows 8.1 keeps going to the BSOD on every startup i do, once it restarts and goes back to desktop it seems to run fine and doesnt BSOD which is quite frustrating. I've zipped up the files needed for you guys to have a view (following the...
BSOD Crashes and Debugging
Windows 8 Metro Apps Auto Startup? Need to disable.
Hello, i'm running Windows 8 Home Premium. I'd like to increase my startup speeds, I already disabled as much as I can in Task Manager, msconfig, etc. In the Task Scheduler, it shows Metro Apps are taking CPU time at startup though. After much searching on the topic, I find very little about how...
Software and Apps
Some programs fail to auto startup
As the title said. Someone my programs that has yellow-blue shield like this 41798 fail to autostart at log-on or windows startup. I tried many ways: registry, put their shortcuts in startup folder, changed gpedit.msc so that they start on log-on... none of them works. Is there anyway to fix this,...
Software and Apps
Can I change the order of auto startup programs Win8
I'd like to change the order in which certain programs in my startup folder load. I don't need to know how to add or remove programs from the startup folder, and I'm not talking about security or system programs. I'm talking about some programs I've added to my computer, which I use all the time in...
Performance & Maintenance
BenQ G922HD PC startup just black then auto turns off
System Specs Intel i5 2400 3.10 Ghz8Gb of Ram1TB SATA HDDAMD Radeon HD 6670motherboard Z77M-D3H rev 1.0Windows 8 Pro X64 Problem: for the past few weeks this problem begun and i dont know how but it just happenedfirst i was wondering why so i checked event viewer and logs involving the...
General Support
Windows 8 Hangs on startup, Auto Repair Can't Fix issue
I apologise if this is the wrong section, this isnt strictly a BSOD crash. Yesterday when shutting down my laptop (which has been upgraded to windows 8 Pro Previously, without issue) windows 8 installed an update. Since then, when trying to boot, windows hangs on the loading scree (spinning...
BSOD Crashes and Debugging
Auto launch an application at windows 8 32 bit startup
Hello All, I have a problem in windows 8 32 bit to auto lunch my application at boot up/start up. Actually I already created registry in: and while I am also created registry in:
Software and Apps

Eight Forums Android App Eight Forums IOS App Follow us on Facebook