MOUNTISO & MOUNTVHD errors

x13

Nov 9, 2016
53
0
Netherlands
Hi all.

Tried using both MOUNTISO and MOUNTVHD for the first time and it's not working.

I get this :

MOUNTISO "D:\IMAGES\MiniTool_9.1_x64.iso"
TCC: (Sys) The request is not supported.
"D:\IMAGES\MiniTool_9.1_x64.iso"
Same goes if I use a drive letter in front of the ISO.
Tries with many ISO's, all of which work in other contexts (like VMware).

Also created a test VHD file and tried :

MOUNTVHD "D:\IMAGES\Test_VHD.vhd"
TCC: (Sys) The device does not recognize the command
"D:\IMAGES\Test_VHD.vhd"
So I mounted it through DISKMGMT, then tried UNMOUNTVHD.
Then I got :

UNMOUNTVHD "D:\IMAGES"
TCC: (Sys) The file or directory is not a reparse point.
"D:\IMAGES"
Why is this happening?

Thanks.
Mark/x13
 
May 20, 2008
9,445
64
Syracuse, NY, USA
Hmmm! I just tried this VHD stuff for the first time and something ain't right. With DISKMGMT.MSC I made a VHD on Win7, put some stuff in it, unmounted it, and copied MYVHD.VHD to Win10. On Win10, in an elevated TCC, I issued
Code:
mountvhd myvhd.vhd
There was no complaint. But I see no evidence that the command was successful ... no new drive in explorer ... no new drive in DISKMGMT.MSC. However, DISKMGMT.MSC won't let me "Attach VHD" using the same file because "it is being used by another process". The TCC mentioned above no longer exists. FILELOCK says process 4 (System) is using the file.

So in a new elevated TCC I issued
Code:
unmountvhd
The help says drive|path are optional, but all I get is
Code:
Usage : UNMOUNTVHD [d:\ | d:\path\]
So now I'm stuck in a situation I don't understand. ... any suggestions?
 
May 20, 2008
9,445
64
Syracuse, NY, USA
... so after a restart, I verified that DISKMGMT.MSC could mount/unmount the VHD file in question. Then I tried with TCC again, this time specifying a drive letter. See below. The first time I tried to mount, I got some inappropriate errors. Then, after verifying the file's existence, the very same command gave no errors, but left me in the same situation as in my last post ... no new drive and System having the file locked.

Code:
c:\apps\workplace> mountvhd e: myvhd.vhd
TCC: (Sys) The parameter is incorrect.
"e:\"
TCC: (Sys) The system cannot find the file specified.
"C:\apps\workplace\myvhd.vhd"

c:\apps\workplace> d
<snip>
3/17/2019  13:29      10,486,272  myvhd.vhd
<snip>

c:\apps\workplace> mountvhd e: myvhd.vhd

c:\apps\workplace> e:
TCC: (Sys) The system cannot find the drive specified.
"E:"

c:\apps\workplace> filelock myvhd.vhd
    4
 
Last edited:
May 20, 2008
9,445
64
Syracuse, NY, USA
I have not had success with the MOUNTVHD and UNMOUNTVHD commands, which is why I'm still using _MountVHD.cmd and _UnMountVHD.cmd under TCC 24 on my Windows 7 64-bit system.

Joe
Cool! Here's a BTM version. It could certainly be pared down and probably be improved upon. No guarantees, but it worked on Win10 (transcript far below). DISKPART is pretty chatty; one might send it'soutput to NUL or to a log file.

Code:
iff %_elevated != 1 then
    echo VHD.BTM must be run elevated.
    quit
endiff

setlocal
set script=%temp\diskpartscript.txt
set vhdfile=%@full[%2]

iff exist %vhdfile then
    echo select vdisk file=%vhdfile > %script
else
    echo The file does not exist: %vhdfile
    quit
endiff

iff "%1" == "/attach" then
    echo attach vdisk >> %script
    if "%3" != "" echo select partition 1^r^nassign letter=%3 >> %script
elseiff "%1" == "/detach" then
    echo detach vdisk >> %script
else
    goto usage
endiff

echo Here's the script.^r^n
type %script
echo.
inkey /c /k"yn" Send the script to DISKPART (y/n)? ... %%response

iff "%response" == "y" then
    echo Sending script to DISKPART ...
    diskpart /s %script
else
    echo Aborting ...
endiff

del /q %script
quit

:usage
echo Syntax: VHD.BTM /attach^|/detach "path\vhdfile" [drive_letter]
quit
Code:
c:\apps\workplace> vhd.btm /attach myvhd.vhd z
Here's the script.

select vdisk file=C:\apps\workplace\myvhd.vhd
attach vdisk
select partition 1
assign letter=z

Send the script to DISKPART (y/n)? ...y
Sending script to DISKPART ...

Microsoft DiskPart version 10.0.18358.1

Copyright (C) Microsoft Corporation.
On computer: BB

DiskPart successfully selected the virtual disk file.

  100 percent completed

DiskPart successfully attached the virtual disk file.

Partition 1 is now the selected partition.

DiskPart successfully assigned the drive letter or mount point.

c:\apps\workplace> vhd.btm /detach myvhd.vhd
Here's the script.

select vdisk file=C:\apps\workplace\myvhd.vhd
detach vdisk

Send the script to DISKPART (y/n)? ...y
Sending script to DISKPART ...

Microsoft DiskPart version 10.0.18358.1

Copyright (C) Microsoft Corporation.
On computer: BB

DiskPart successfully selected the virtual disk file.

DiskPart successfully detached the virtual disk file.
 

x13

Nov 9, 2016
53
0
Netherlands
I thought the point of creating the MOUNTISO and MOUNTVHD commands was exactly to avoid having to write such scripts? ...
 

rconn

Administrator
Staff member
May 14, 2008
11,021
98
Tried using both MOUNTISO and MOUNTVHD for the first time and it's not working.
I can't reproduce any problem with MOUNTISO (provided it's running elevated). Your error is coming from Windows (not TCC), and is what I'd expect for a non-elevated session.

There is an issue with MOUNTVHD if it fails with an error the first time (Windows is not releasing the VHD file). I've fixed that for the next build.
 

x13

Nov 9, 2016
53
0
Netherlands
I believe you.

Yet, I still get the same error.
I don't even understand the error message.

Could it be that UltraISO (virtual drive = W:) somehow interferes with the command?
Doubtful, because I tested this in VMware and I get the same result...


> MOUNTISO "D:\IMAGES\Linux\Mint\Mint_19.1_Tessa.iso"
TCC: (Sys) The request is not supported.

> VER
TCC 24.02.44 x64 Windows 7 [Version 6.1.7601]
FYI.