• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

VHD - Auto-mount at Startup in Windows 8


KYHI

Well-Known Member
Pro User
Posts
2,751
#41
MountVHD.cmd
Code:
cd /d "%~dp0"
diskpart /s MountVHD.txt
exit
MountVHD.txt
Code:
select vdisk file="D:\VHD\Name.vhdx"
attach vdisk
assign letter=V
Place in same folder >
Name.vhd
MountVHD.cmd
MountVHD.txt

Then create a shortcut to "MountVHD.cmd" in "User" "Programs" "Startup" Folder

Now when "User" login - the "MountVHD.cmd" is run from the "Startup" Folder (Just a work around to using task manager)
 

My Computer

System One

  • OS
    Windows 3.1 > Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Dell XPS 8700
    CPU
    I7
    Memory
    24 GB

Moniquekc

New Member
Posts
5
#42
Thanks Everyone for trying to help. It was my mount script. I realized I was only putting " select vdisk=" instead of "select vdisk file"... The task couldn't start because the script wasn't directing it to the vhdx.
 

My Computer

System One

  • OS
    Windows

BWB8771

New Member
Posts
5
#43
@bbrescia - did you ever figure out why you were getting the "There is no volume specified"? I ask because I too am getting that message, but the curious thing is that this script had been working just fine up until several weeks ago. I haven't been able to make troubleshooting this issue a priority until now, so I really don't know what updates/changes might've "broken" this for me.
 

My Computer

System One

  • OS
    Windows 8.1

DavidY

Active Member
VIP Member
Pro User
Posts
955
#44
@bbrescia - did you ever figure out why you were getting the "There is no volume specified"? I ask because I too am getting that message, but the curious thing is that this script had been working just fine up until several weeks ago. I haven't been able to make troubleshooting this issue a priority until now, so I really don't know what updates/changes might've "broken" this for me.
Hi BWB8771

One thing I would try is to attempt running the commands manually to see if it gives more information. So you could try these steps. If there are any errors, note the message down and type exit to get out of diskpart :
  1. open an elevated command prompt
  2. enter the command: diskpart
  3. when Diskpart loads, enter the command: select vdisk file="{Path to your VHD}"
  4. enter the command: attach vdisk
  5. does that work without generating an error?
  6. If it all worked, enter this command to detach the vdisk: detach vdisk
  7. whatever happened, enter this command to exit diskpart: exit
Does that work without errors? If there was an error, what was the error message?
 

My Computer

System One

  • OS
    Windows 8.1, 10

BWB8771

New Member
Posts
5
#45
@DavidY - thanks for taking the time to reply. I encountered no issues or errors while performing your steps 1-7,

When I run diskpart /s c:\batch\Attach_VHD.txt I encounter:
There is no volume specified.
Please select a volume and try again.

The script in the "Attach_VHD.txt" is:
select vdisk file=Z:\FileHistory.vhd
attach vdisk
rescan
rescan
rescan
rescan
select partition 1
assign letter=H


The italicized lines were ones that I added on anecdotal advice in this thread.

Even though I am still getting that "no volume.." message, my VHD successfully mounts to drive H:, so I am okay with this. Of course, now that I've said/posted that, I'm going to jinx myself :)
 

My Computer

System One

  • OS
    Windows 8.1

DavidY

Active Member
VIP Member
Pro User
Posts
955
#46
@DavidY - thanks for taking the time to reply. I encountered no issues or errors while performing your steps 1-7,
....
Even though I am still getting that "no volume.." message, my VHD successfully mounts to drive H:, so I am okay with this. Of course, now that I've said/posted that, I'm going to jinx myself :)
Right I think I know what's happening.... I think I made a mistake in the original tutorial! Apologies! :eek::eek:

The statement "assign letter=h" should be deleted from the script file - I think the best way to set the driver letter is in disk management when the VHD is created, or use disk management to change it later. Luckily, once you've assigned a letter to a VHD, it 'remembers' it the next time it starts up.

The command "assign letter=h" only seems to work in diskpart if you have already selected the volume beforehand, and I think the only ways to select a vdisk volume are (a) if it already has a drive letter, or (b) if you know the volume number - which could vary depending on other factors so I'm not sure there's a safe way to determine that at run time if it is being called by Task Scheduler.
 

My Computer

System One

  • OS
    Windows 8.1, 10

mpiva

New Member
Posts
1
#47
Hi,

I have applied the procedure (included assign letter ...) ant it works. Thanks for procedure ... it's very useful to overcome a very annoying problem on Windows 10: impossible put OneDrive folders in SD card. I find the solution more/less at the beginning of august.

The Auto_mount procedure stopped to work after 3 days ... I discovered that there is a parameter to uncheck. ("configuration tab", "Stop if ... 3 days was checked by default)

But today, in september, the auto Mount hasn't work again ... and I do not have any idea: there is a message in Planning Utility Window: "Parameter not correct (0x80070057)".

Do you have any idea?

Thanks.

Massimo
 

My Computer

System One

  • OS
    WINDOWS 10

DavidY

Active Member
VIP Member
Pro User
Posts
955
#48
Hi,

I have applied the procedure (included assign letter ...) ant it works. Thanks for procedure ... it's very useful to overcome a very annoying problem on Windows 10: impossible put OneDrive folders in SD card. I find the solution more/less at the beginning of august.

The Auto_mount procedure stopped to work after 3 days ... I discovered that there is a parameter to uncheck. ("configuration tab", "Stop if ... 3 days was checked by default)

But today, in september, the auto Mount hasn't work again ... and I do not have any idea: there is a message in Planning Utility Window: "Parameter not correct (0x80070057)".

Do you have any idea?

Thanks.

Massimo
Hi Massimo,

I'm not sure.

Could you post a copy of the script you are using, and a screenshot of Task Scheduler, showing the command you are running?

David
 

My Computer

System One

  • OS
    Windows 8.1, 10

jetzerwar

New Member
Posts
2
#49
This is a great fix... and updating to Win 10 broke it somehow.

Any help would be much appreciated!

I'm running an Asus Transformer Tablet (originally win 8.1, now win 10). Like I said, I had it working great when the tablet was running Win 8.1, and the updated to Win 10 apparently killed it.

The VHDX is on an SD card, drive letter D. I can open diskpart and manually enter the text in my mount script.txt file and it all works, so I'm really stumped as to why the mount script itself doesn't work.

When I try running the mount script.txt from Run, a command window pops up and disappears without doing anything. Anyway, here are my settings:

VHDX location:
D:\Media Store.vhdx

text file location:
C:\external card\mount script.txt

sc1.PNG

sc2.JPG

text of mount script:

select vdisk file="D:\Media Store.vhdx"
attach vdisk
assign letter=f

FWIW, under last run result I get "Unspecified error (0x80004005)".

EDIT:

I tried running thte script from an elevated command prompt and got the error message:
DiskPart was unable to open or read the script file.
Make sure the file you specified exists.​
 

My Computer

System One

  • OS
    Win 10, Win 8.1, Linux,

KYHI

Well-Known Member
Pro User
Posts
2,751
#50
in your second screen shot put quotes " " around "C:\ blah blah.txt"

command prompt does not like SPACES in names unless in qoutes
 

My Computer

System One

  • OS
    Windows 3.1 > Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Dell XPS 8700
    CPU
    I7
    Memory
    24 GB

iAmJonny

New Member
Posts
2
#53


We are a freeware development team (sordum.org) and just read the topic and created a very small portable App to solve the problem (VHD - Auto-mount at Startup) it is very easy to use :

1. Right click Diskpart_svr.exe and run as admin
2. Edit the first command and use install service Button , if you want to uninstall it just use uninstall button

Any feedback will be greatly appreciated
Downlod:
http://www.sordum.net/forum/download/file.php?id=93
Does this only work as an installed service?
Can this exe be called to complete the operation ('portably')?
Is there any way to request the diskpart /mount operation at bootExecute (assuming this is the earliest occasion at which an executable launch can be requested?

I miss autoexec.bat
 

My Computer

System One

  • OS
    windows 7,10

KYHI

Well-Known Member
Pro User
Posts
2,751
#54
What do you want to do - AutoMount a VHD or Boot a VHD
 

My Computer

System One

  • OS
    Windows 3.1 > Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Dell XPS 8700
    CPU
    I7
    Memory
    24 GB

kremster

New Member
Posts
3
#56
DavidY - thanks for the detail here. I have a Surface Pro 3 and my hard drive is almost full. I purchased a 64GB SD Card to hopefully work around that. I followed the instructions on the post I thought exactly. When I re-booted I don't see the new drive at all. I had turned on BitLocker before I did any of your steps, not sure if that's the difference? I don't ever get prompted to put in a BitLocker password though. Let me know what you think. Thanks!
 

My Computer

System One

  • OS
    Windows 8.1Pro
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Surface Pro 3

DavidY

Active Member
VIP Member
Pro User
Posts
955
#57
DavidY - thanks for the detail here. I have a Surface Pro 3 and my hard drive is almost full. I purchased a 64GB SD Card to hopefully work around that. I followed the instructions on the post I thought exactly. When I re-booted I don't see the new drive at all. I had turned on BitLocker before I did any of your steps, not sure if that's the difference? I don't ever get prompted to put in a BitLocker password though. Let me know what you think. Thanks!
Hi kremster,

Really sorry - I had a busy week and didn't respond sooner.

Can you describe how your drive letters are organised, please? How are you using the VHD file?

I believe that you could encrypt the whole SD card with Bitlocker without using a VHD drive at all - see here, for instance.
http://www.eightforums.com/tutorials/21188-bitlocker-turn-removable-data-drives-windows-8-a.html

Or it is something else which you're trying to do?

Regards
 

My Computer

System One

  • OS
    Windows 8.1, 10

kremster

New Member
Posts
3
#58
DavidY,

Thanks for the response. I guess I should be a little more clear on what I'm doing, sorry I thought you could read my mind. :)

So as I mentioned I got that 64GB SD Card for my Surface Pro 3. I'm still running 8.1 but need to upgrade to 10 so if it makes sense to upgrade before I proceed, just let me know.

We use OneDrive to sync our files to the cloud. My hard drive is nearly full so my ability to sync new data to OneDrive is running out very soon as my hard drive fills up. So I'm trying to format the SD Card to where my machine will actually recognize it as a drive (rather than removable media) and then I can sync OneDrive files to it. I first completed the steps on this page:
On Windows 8 or 10, particularly on tablets with a permanently inserted SD card, is there a universal way to treat the card as a non-removable drive? - Super User

While going through that, it said the following "Now, the trick to bring it all together is to set up Windows so that the drive is mounted when the computer boots, as it's no fun having to go into Disk Management each time your computer starts to mount the drive. To do this, you'll need to create a script for mounting it, and then using Task Scheduler to execute the script on boot. I found a really good guide here, which I'll summarize below." - I followed those steps closely while just changing the naming conventions slightly.

That 'here' reference above is of course to your page about doing the VHD Auto-Mount and that sounded like something I should incorporate. I should probably caveat this whole thing with the fact that I'm not an IT professional. I certainly know more than the average Joe and I'm seen as the IT guy in my office (unfortunately) but I'm not overly technical and this process is a bit out of my league. Anyway, I walked through the steps on the other article, together with yours, and once completed I don't see the new SD Card anywhere within File Explorer. I actually do see it under C:/SD Card, but when I try to access it, it gives me an error saying that Location is not available.


I can still see the SD Card under Disk Management as File System Unknown (BitLocker Encrypted) and Status is Health (Primary Partition).

I tried to include screenshots of both of those but it didn't seem to let me post those?

Anyway, let me know if you think I should start over and add BitLocker after the fact - if this is the case, I assume I just need to re-format the SD Card and I'll be back at the beginning of the process? Or should I upgrade to Windows 10 first, then re-try these steps? Hopefully that better explains it. Let me know! I appreciate it.
 

My Computer

System One

  • OS
    Windows 8.1Pro
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Surface Pro 3

KYHI

Well-Known Member
Pro User
Posts
2,751
#59
If your drive is rather full - you will have a hard time upgrading to windows 10...

I see you mention C:\SDCard - is there a . vhd or .vhdx file in that directory ??

Because it appears to me you formatted the SDCard and mounted as a folder C:\SDCard

try to add a file into C:\SDCard (the SDCard is now mounted as a folder on C:\ and not a drive with drive letter)

And just a side note - a vhd can be mounted from removable media - although not sure about using onedrive sync with removable media - but a vhd would also be assigned a drive letter

It seems to me that you should sync the onedrive cloud storage with C:\SDCard
 

My Computer

System One

  • OS
    Windows 3.1 > Windows 10
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Dell XPS 8700
    CPU
    I7
    Memory
    24 GB

kremster

New Member
Posts
3
#60
If your drive is rather full - you will have a hard time upgrading to windows 10...

I see you mention C:\SDCard - is there a . vhd or .vhdx file in that directory ??

Because it appears to me you formatted the SDCard and mounted as a folder C:\SDCard

try to add a file into C:\SDCard (the SDCard is now mounted as a folder on C:\ and not a drive with drive letter)

And just a side note - a vhd can be mounted from removable media - although not sure about using onedrive sync with removable media - but a vhd would also be assigned a drive letter

It seems to me that you should sync the onedrive cloud storage with C:\SDCard
- Yes I put a .vhdx file in the C:\SD Card directory
- "Because it appears to me you formatted the SDCard and mounted as a folder C:\SDCard" - yes, that's what I attempted - not sure if I did it correctly given the errors I'm getting.
- I tried to add a file to C:\SD Card and I get the same error - "Location is not available"
- I expected that the VHD would assign the SD card it's own drive letter, but that didn't happen.
- "It seems to me that you should sync the onedrive cloud storage with C:\SDCard" - this is what I'm trying to do. Unsuccessfully thus far.

Regarding the upgrade to Windows 10, I could free up another 12GB of data once I can figure out this SD Card and move those files from my C drive over to the SD card. So I would think 25GB free should be enough space for the upgrade to 10?
 

My Computer

System One

  • OS
    Windows 8.1Pro
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Surface Pro 3

Users Who Are Viewing This Thread (Users: 0, Guests: 1)