- LogonUser with executing a batch script via cmd.exe
- Posted by Lyle Coder on October 6th, 2004
Hi,
In my program which is launched via a modified msgina (and hence runs
as SYSTEM), I do the following
1. LogonUser
2. ImpersonateUser
3. CreateProcessAsUser (with the security token obtained via
LogonUser)
For the CreateProcessAsUser, I execute cmd.exe and pass in a batch
file to run which mounts drives via "net use".
The drives mount fine, however, the drives are ONLY AVAILABLE to that
cmd window. Any other process (like explorer or some other cmd shell)
cannot see those drives
Any clues?
Thanks
Lyle
- Posted by Sten Westerback on October 11th, 2004
"Lyle Coder" <x_coder@hotmail.com> wrote in message
news:49fdc875.0410052204.2bbc5716@posting.google.c om...
Virtual drives (made by Net use) are stored in Registry under
HKEY_CURRENT_USER.
When your code runs there is no such hive loaded as SYSTEM doesn't have one
and the
API's you specify doesn't load one.
Anyway.. to give permission to network drives to a specific user you a) need
the users
account credentials and b) need to store the account etc in his/her Registry
hive. Thus
i can't see the point in your excersise - why not just use a logon script, a
shortcut in
All Users\... Startup or a command line under Run in HKLM ?
- Sten
- Executing a script before entering standby (Microsoft Windows) by Matt Brown - identify
- Executing QBasic script (MS-DOS) by Tarmo Tanilsoo
- Error 732 while executing batch with PM8 (Storage Devices) by Patrick E. King
- LogonUser with executing a batch script via cmd.exe (Development Resources) by Lyle Coder
- Login Script under group policy not executing on the NT clientmachine (Windows NT) by Torgeir Bakken (MVP)

