Menu

ImDisk-Dlg.exe Usage/Arguments/Switches list???

Chuck Bass
2020-01-23
2020-11-16
  • Chuck Bass

    Chuck Bass - 2020-01-23

    Is there any documentation on what switches are available to use with ImDisk-Dlg.exe? I tried using "/?" "-h" "--help" but it doesn't output anything. I checked the Wiki and it only lists a few switches to use with the installer.

     
  • v77

    v77 - 2020-01-23

    Well, I never thought that someone could want to use it from command line...

    Currently, there are only 2 commands: RM (remove) and CP (copy).
    RM is used to unmount a volume, and CP to save it as an image file.
    The 2nd argument is a drive letter or a mount point.

    So for instance, to save X: as an image file:
    ImDisk-Dlg.exe CP X:
    And to unmount it:
    ImDisk-Dlg.exe RM X:

     
  • Chuck Bass

    Chuck Bass - 2020-01-23

    Oh hell yeah! I had integrated it into one of my batch scripts so that it would automatically unmount a VMDK image at the end of my script. And apparently I must have searched Google or something at one point because I was using this command (ImDisk-Dlg.exe" UAC RM "G:") to unmount images, but it wasn't working in the latest 20191126 version.

    I saw that someone else posted saying that the "unmount" command wasn't working and I read that the solution was to just remove the "UAC" from the command which resolved the issue for me. But then it got me to thinking on if there was any documentation showing other switches that might be available and so I decided to make this post.

    So yeah, anyways, just two switches then. I'll be sure to add that to my notes. Thanks!

     
  • v77

    v77 - 2020-01-24

    Because of last changes about administrative privileges, I removed the "UAC" command from ImDisk-Dlg so that it always asks them.
    The installer makes the proper changes in the registry keys related to the drive letter context menu. Of course, this assumes that you use the installer, and nothing locks these registry keys.

    If you want to remain in command line, another way to unmount a volume is to use a command such as:
    imdisk.exe -D X:
    (you can also replace -D with -d if you want to be warned if anything is open on the volume and therefore the latter cannot be locked)

     
  • Chuck Bass

    Chuck Bass - 2020-01-25

    Where is "imdisk.exe" located? I'm only seeing "config.exe", "ImDisk-Dlg.exe", and "MountImg.exe" in my Program FIles folder.

     
  • v77

    v77 - 2020-01-25

    Like other user mode parts of the driver (imdisk.cpl and imdsksvc.exe), it is installed in %windir%\System32.

     
  • Chuck Bass

    Chuck Bass - 2020-01-26

    Oh that's right I forgot about that.

    After seeing the amount of stuff that "imdisk.exe" can do via cmd-line, I'm wondering what would be the benefit of even using "ImDisk-Dlg.exe"? I'm assuming "ImDisk-Dlg.exe" has some other specific purpose that it's more suited for?

    Also, after checking out the other switches for Imdisk.exe, it would appear that it's possible to mount VMDK files using this command. Right now I've just been usign the "MountImg.exe" command to mount my VMDK files but it's not fully automated as that only opens the Mount window where I still have to click "Ok". So I figured I would give Imdisk.exe a try and here is what I came up with...

    Imdisk.exe -a -t file -f "disk.vmdk" -m G:

    This mounted the image, but I got the "you need to format this disk" popup as I'm sure is becaue I probably need to specify the filesystem that's on the image with another switch? Or is this not the intended purpose of the Imdisk.exe command?

     

    Last edit: Chuck Bass 2020-01-26
  • v77

    v77 - 2020-01-26

    I made Imdisk-Dlg to replace the dialog boxes of the control panel (imdisk.cpl) that are used in the drive letter context menu, mainly to get them translated and to have a progress state when saving a volume in an image file.

    Like imdisk.cpl, Imdisk-Dlg.exe is a GUI application, so the progress state and the errors are displayed in dialog boxes, while imdisk.exe is a console application and provides messages only in a console.
    So you have to choose the best suited one for your needs.

    imdisk.exe cannot mount VMDK files... unless it is not dynamic, and if you know the correct offset to the beginning of the volume inside the image.
    Anyway, I don't recommend that.
    In fact, imdisk.exe can only mount plain RAW image files, with possibly an offset (in case of a header, MBR and so on).

    You can mount a VMDK file from command line (with administrative privileges) by using DiscUtilsDevio.exe. Run it without argument to get the syntax help.
    There is a bug though: if you don't dismount the volume, Windows will be stuck at the shutdown (the issue is fixed by the GUI).

     
  • Chuck Bass

    Chuck Bass - 2020-01-27

    Ok I gave "DiskUtilsDevio.exe" a try, I got it to mount the image no problem, however, the process remains on the cmd-line window and says to "Press Ctrl+C to remove and exit". I couldn't find a switch that would allow the process to exit rather than remain. So used "taskkill /f /im DiskUtilsDevio.exe" to kill the process, and then attempted to use ImDisk-Dlg.exe RM "G:" to remove the volume, but all I got was a small dialog window that shows "ImDisk" in the Title, and "Locking volume..." in the window area, and now is just stuck there.

    I also tried using the "ImDisk Virtual Disk Driver" control panel applet to "Remove" the volume, but that resulted in another dialog window showing "Flushing file buffers..." which is now stuck as well.

    Lastly, I tried using "ImDisk.exe -d -m G:" to remove the volume, but all I got was "Notifying applications..." and it just hangs there. I even tried "-D" instead of "-d" but that gave the same result.

    At this point, I can't think of any other way to remove the volume except to reboot (kicking myself in the ass for not testing this in a VM first). So is there a better way to handle this situation? Perhaps a switch I can use to get to get the "DiscUtilsDevio.exe" process to exit instead of remain? Or am I just stuck with leaving the window open and using "Ctrl+C" to remove the volume?

     

    Last edit: Chuck Bass 2020-01-27
  • v77

    v77 - 2020-01-27

    DiscUtilsDevio is an imdisk proxy. It's the one that retrieves the I/O requests to the volume and makes all the reads/writes on the image file. Therefore, it must remain loaded as long as you are using the volume.
    The GUI also uses DiscUtilsDevio when the image file cannot be mounted directly, and keep it loaded in the background. DiscUtilsDevio exits automatically when the volume is dismounted.
    The other proxy embedded in the toolkit is RamDyn, which is used for dynamic ramdisks.

    If you kill the proxy without dismounting the volume, the system continues to send I/O requests, but as there is nothing to handle them, the system is stuck.
    To unblock that, if you can still get a command prompt, there is the following command:
    imdisk -R -u unit
    This remains dirty though: it's just to unblock the volume driver (imdisk). The file system is not aware that the volume is no longer in use, like when a volume is dismounted without administrative privileges, so some resources are not freed.

     
  • Chuck Bass

    Chuck Bass - 2020-01-28

    Ok so I just want to confirm one last time, out of all these commands is there one that will just mount a VMDK image WITHOUT a dialog box or a command window that gets left in the background? I simply just want to mount a VMDK using one batch script, and then use my other batch script to unmount it. Obviously I've got the "Unmounting" covered with the ImDisk-Dlg.exe" RM "G:" command. And from your previous post, it sounds like using "ImDisk.exe" isn't a candidate. Using "DiscUtilsDevio.exe" works but then leaves a command window in the background, which my only concern with that is that it might accidentally get closed in the process of doing work. I tend to have a LOT of windows open once I really get going on a project.

    So in your opinion, is there currenly no better solution to mounting VMDK files than using "MountImg.exe image.vmdk"? I've been using that and it works fine, the only negative is that I have to click on "Ok" when the dialog window pops up, where alternatively it would be nice to just issue the full command and just have the VMDK mount in the backgroudn with no user interaction.

     
  • v77

    v77 - 2020-01-28

    Yeah, it seems difficult to start DiscUtilsDevio without having its console window.
    Maybe I could add some switches to MountImg...

     
    • Mark The Devil

      Mark The Devil - 2020-11-16

      it's not difficult at all, just open the exe in a PE editor and change the flag from console program to window console... it works :)

       
  • Chuck Bass

    Chuck Bass - 2020-01-30

    Sounds good man. I'll check back another time then. Thanks for all the info, help, and most importantly your work! I really appreciate it. =)

     
  • maeiky

    maeiky - 2020-02-06

    I'm waiting for this too! In addition, if we could get a feedback of which drive/folder, is mounted. To be able to unmount this one with a script.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.