Menu

Minimal files for mounting by command line

Anon
2019-12-24
2019-12-27
  • Anon

    Anon - 2019-12-24

    Hi there

    What are the minimal files I need to redistribute to allow for creating and mounting an empty virtual USB drive by CLI script please? Obviously imdisk.exe but what else - DLLs etc? I'd like to create and mount the drive without actually installing anything on the machine. The script will run as SYSTEM so no problem with UAC/local admin etc.

    Many thanks

     

    Last edit: Anon 2019-12-24
  • v77

    v77 - 2019-12-24

    You need at least imdisk.exe, imdisk.cpl and imdisk.sys.
    Imdisk.sys is the driver. You must register it and load it with the sc create and sc start commands.

     
  • Anon

    Anon - 2019-12-24

    Thanks for coming back so quickly.
    What do i need imdisk.cpl for?
    How do i register and load it? sc create can be either own, kernel, filesys or rec - any of these could work..? do you have an example please?
    Many thanks

     
    • Olof Lagerkvist

      Olof Lagerkvist - 2019-12-24

      You don't need to register or load imdisk.cpl manually. Just put it in the same directory as imdisk.exe. It is used internally by imdisk.exe. The imdisk.sys driver file can be registered using this command:

      sc create imdisk type= kernel start= auto binPath= system32\drivers\imdisk.sys

      You also need to put imdisk.sys in C:\Windows\system32\drivers directory.

       
      • v77

        v77 - 2019-12-25

        You also need to put imdisk.sys in C:\Windows\system32\drivers directory.

        In fact, this point is not required. The file can be at any location, as long as the full path is specified with "binPath=".

         
        • Olof Lagerkvist

          Olof Lagerkvist - 2019-12-25

          That is correct. I just wanted to keep things as simple as possible here and not specify to many ways to do the same thing.

           
  • Anon

    Anon - 2019-12-27

    fantastic many thanks you guys, much appreciated

     
  • Anon

    Anon - 2019-12-27

    having trouble starting the service (imdisk.sys is in %windir%\system32\drivers)

    sc create imdisk7 type= kernel start= auto binPath= %windir%\system32\drivers\imdisk.sys
    [SC] CreateService SUCCESS
    
    sc start imdisk7
    [SC] StartService FAILED 183:
    
    Cannot create a file when that file already exists.
    

    any thoughts please?
    thanks again :)

     
  • Anon

    Anon - 2019-12-27

    additonal: looking in services.msc i see the IMDisk helper service running as C:\windows\system32\imdsksvc.exe - do i not need this?

     
    • v77

      v77 - 2019-12-27

      What is was said in this thread assumes that you didn't install the driver using an installer (like the Toolkit or the Olof's installer).
      If you have this service running, it's clearly not the case.

      As a consequence, the driver fails to start (because it is already running).
      And about the helper service, it is only required for some types of proxies (that is, an extension of the driver that you can write to intercept the I/O requests to the volume). So for now, you can ignore it.

       

      Last edit: v77 2019-12-27
    • Olof Lagerkvist

      Olof Lagerkvist - 2019-12-27

      Sorry, mistake. I missed the part that you were actually trying to create another service entry for ImDisk driver. Like v77 says, that would not work because of name collisions for kernel global objects.

       

      Last edit: Olof Lagerkvist 2019-12-27

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.