Jump to content











Photo
- - - - -

ImDisk CmdLine Pre-Logon (Windows Service)


  • Please log in to reply
6 replies to this topic

#1 Thracx

Thracx

    Newbie

  • Members
  • 18 posts
  •  
    United States

Posted 03 December 2010 - 04:54 PM

Short Version:

Can ImDisk be configured to create a RamDisk before user logon using imdisk.exe cmdLine parameters?


Long Version:
ImDisk.exe can be executed with a great variety of cmdLine parameters, here's my current everyday RamDisk config:
imdisk.exe -a -t vm -o fix -o hd -o rw -s %RamDiskSize% -m %RamDiskDrive% -p "/FS:ntfs /V:RamDisk /Q /Y"
which I currently have executing at logon from a cmd file (which also creates some default folders and symbolic links, sets up permissions, etc). I really like being able to setup RamDisk via the cmdLine. Olof did a great job providing excellent cmdLine features.

The obvious problem with this is that:
  • The RamDisk is not available until after a user has logged in
  • The RamDisk script needs to be 'auto-started' by any user, but therefore could be executed multiple times by multiple logins.
    [Hack-Solved via script ignoring duplicate attempts]
  • The script must be started with admin privilege (UAC Compatibility) (which requires 2 manual steps but this could be mitigated if I took the time)
  • The RamDisk is not available until after a user has logged in
I've set the ImDiskSrv to auto start but I am unable to provide it with my cmdLine parameters. I've found the registry configuration method, but wasn't able to find much documentation on it (i.e. not sure how to fully convert my cmdLine string into Reg keys). More importantly, I would rather not have to maintain 2 totally different configuration methods (i.e. cmdLine and registry), so I would strongly prefer a way to always use the cmdLine interface.

You can copy and paste the question from my short version here - is there a way to do this? If not, can anyone offer any ideas on solutions? Olof - feature request?

If it cannot be done, my current thoughts are to get help converting my above cmdLine string into Registey Parameters (ewww) or to create a custom Windows service which simply runs my script (ewwwy-er).

PS:
ImDisk is awesome. Thanks Olof - I owe you for all the effort you put into this tool!


Relivent System Info:
Windows 7 x64 Pro (patched thru 2010.12.03)
ImDisk v1.3.1 (2010.08.02)


#2 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 03 December 2010 - 05:07 PM

Maybe helps, check nssm
http://iain.cx/src/nssm/

#3 Sha0

Sha0

    WinVBlock Dev

  • Developer
  • 1682 posts
  • Location:reboot.pro Forums
  • Interests:Booting
  •  
    Canada

Posted 03 December 2010 - 06:59 PM

Why not use a computer startup script via gpedit.msc, or Group Policy - Local Computer Policy?

#4 Thracx

Thracx

    Newbie

  • Members
  • 18 posts
  •  
    United States

Posted 03 December 2010 - 07:08 PM

Why not use a computer startup script via gpedit.msc, or Group Policy - Local Computer Policy?

Brilliant! Thanks Sha0!

I'll edit this post if I'm successful in getting it to work.


Edit:
Seems to work well. The script runs as Local System Account, which might be a problem for others but will be fine for my purposes.

While I would still prefer ImDisk to support such a feature naively (to keep configuration associated with the component they apply to), this method seems to work very well as a workaround - thanks again Sha0!

Edited by Thracx, 03 December 2010 - 07:28 PM.


#5 Thracx

Thracx

    Newbie

  • Members
  • 18 posts
  •  
    United States

Posted 03 December 2010 - 07:30 PM

Maybe helps, check nssm
http://iain.cx/src/nssm/

Thanks for the tip Lancelot, assuming nssm is x64 compatible and properly signed, it would probably server as a good workaround.

#6 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1448 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 09 December 2010 - 09:50 AM

Brilliant! Thanks Sha0!

I'll edit this post if I'm successful in getting it to work.


Edit:
Seems to work well. The script runs as Local System Account, which might be a problem for others but will be fine for my purposes.

While I would still prefer ImDisk to support such a feature naively (to keep configuration associated with the component they apply to), this method seems to work very well as a workaround - thanks again Sha0!


Could be something for the future but there are many other feature request I will try to implement before this one because there are many options to get this done anyway. It is a reasonably simple task these days to put the command line for it in a local policy startup script like you did here or otherwise simply use Windows Scheduler to schedule the command line to run at system startup. If you use Windows Scheduler you also get the option to select which user account it will impersonate when the task runs. That could be useful for example if you need network access to a remote image file etc.

So, I leave this matter for now but I may come back to it in the future.

#7 Thracx

Thracx

    Newbie

  • Members
  • 18 posts
  •  
    United States

Posted 11 December 2010 - 07:23 PM

So, I leave this matter for now but I may come back to it in the future.

Sounds reasonable - thanks for considering it for the future!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users