Defcon31,
I did not use RunOnceEx for the purpose of setting up user accounts. Using
StartUp batch files appeared to be more clear to accomplish that. However,
all the ugly logic you will see below may be implemented through the
RunOnce[Ex] key.
My batch files are full of info you don't need for your project, they have
got my project's specifics so they won't do much for you.
However, there is nothing smart in the batch files and it is easy to repro
the basic logic here. I'll discribe the scenario:
Assumptions:
Regedit.exe in your image (or reg.exe) ("Registry Editor" component);
XP shutdown.exe in your image (Software : System : System Services :
Base : "Misc. Command Line Tools" component);
"Automatic Logon" component in your image (or you change Autologin
registry values directly);
"Administrator account" and a couple of "User Account" (User 1, User2)
components are in your image. The account properties are set accordingly to
your needs (user groups, password, etc.);
User account group rights enough to modify [HKLM\..\Winlogon] registry
key.
Create a component with a set of batch and .reg files:
Start.bat file under \Documents and Settings\All Users\Start
Menu\Programs\Startup directory.
Place the following files anywhere on target (e.g. under root):
User1.bat, User1.reg - user1 specifics (files, registry settings,
etc.);
AutologinUser1.reg - a reg. file to set User1 autologin;
User2.bat, User2.reg - user2 specifics (files, registry settings,
etc.);
AutologinUser2.reg - a reg. file to set User1 autologin;
Administrator.bat, Administrator.reg - - user2 specifics (files,
registry settings, etc.);
AutologinAdministrator.reg - a reg. file to set Administrator
autologin;
ClearAutologin.reg - a reg. file to clear autologin registry
settings;
(You may add the files to your image with TD Extra Files feature but making
your own component would separate your user account setup logic).
Autologin<User>.reg files should look like:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon]
"DefaultUserName"="<User>"
"DefaultPassword"="<User Password>"
"ForceAutoLogon"="1"
"AutoAdminLogon"="1"
"AutoLogonUser"="<User>"
ClearAutologin.reg files should look like:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon]
"DefaultUserName"=""
"DefaultPassword"=""
"ForceAutoLogon"="0"
"AutoAdminLogon"="0"
"AutoLogonUser"=""
<User>.reg may include any user account specific registry setting depending
on your needs.
<User>.bat files should include:
regedit.exe /s \<User>.reg
del /Q \<User>.reg
+ any user specific logic.
In TD you set "Automatic Logon" settings to log in to any of the user
accounts (e.g. User1). If you set it to User1, you won't need
AutologinUser1.reg.
The Start.bat file should be very simple and make calls to user batch files.
Start.bat:
IF EXIST \User1.bat (
call User1.bat
del /Q User1.bat
regedit.exe /s \AutologinUser2.reg
del /Q \AutologinUser2.reg
goto RESTART
)
IF EXIST \User2.bat (
call User2.bat
del /Q User2.bat
regedit.exe /s \AutologinAdministrator.reg
del /Q \AutologinAdministrator.reg
goto RESTART
)
IF EXIST \Administrator.bat (
call Administrator.bat
del /Q Administrator.bat
regedit.exe /s \ClearAutologin.reg
)
shutdown.exe /f /r /t 03
del /Q "\Documents and Settings\All Users\Start
Menu\Programs\Startup\Start.bat"
goto NOTHING
:RESTART
REM restart...
shutdown.exe /f /r /t 03
:NOTHING
Change Start.bat file to add/remove/modify anything that may be necessary to
meet your project requirements.
You don't necessary need to reboot your device each time you switch the user
but rather to log off (there might be sometimes a need to reboot the device
depending on the user settings you are trying to preset). To log off, change
shutdown call to "shutdown.exe /f /l /t 03".
Also, at the end of the Start.bat file (just before cleaning up itself) you
may change user account rights settings using an appropriate command line
tool from NT/2K/XP Resource Kits (e.g. cusrmgr.exe, ntrights, etc.).
And last hint - you may use reg.exe instead of set of the .reg files.
After the last reboot (log off) device is setup and ready.
Hope this helps,
KM,
BSquare Corp.
hello KM,
today was my lucky day. thanks to you, after many days of trying to
accomplish this, it finaly seems it's going the right way..
i made a batch file and set it in the HKLM....\RunOnceEx registry...
now it sets everything for ONE user.
but how do I have to automate it in the batch file so that
he does it for the other users?
it's not so clear how you do it with that "autologon" always like you
described...
(do you let the batch file logoff and logon maybe?)
(or when the autologon-key changes, does the system saves the HKCU
settings
automatically?)
seems all very complicated
is it maybe possible to post your code of your bat files?
it would be a great help for me to accomplish my final school project,
anyway,
thanks in advance!
Defcon31,
I am wondering why you can't use FBA reseal mode? If you set fbareaseal
to
launch manually, you can prepeare your runtime image - create and set up
your user accounts as necessary, then manually reseal it and use the
image
as your golden image to be copied on to all devices. If you need unique
device names, SIDs and etc., you will have to include System Cloning
Tool
component (check XPe docs).
My problem was that I had to automate the setup anyway. So, I ended up
creating a set of batch and .reg files that were self-managed to run
under
a
few user accounts. After FBA I was using Autologon to log in to
particular
user and run a batch file as a All Users/Startup item. Then the batch
file
was switching Autologon registry settings to another user, cleaning up
itself and making another batch file as a All User/Startup item. This
scenerio was continueing until all the users were setup. This is a
painful
process when you do that first time but when the logic is set up and
understood, it is becoming eaiser to add new things (new files, new
accounts, new settings). Also, I did not have to manually setup the
image
each time I changed TD configuration (added/removed/modified
components).
Automating post-FBA phase was laso very helpful for image testing and
reproducing purposes (no human errors).
So, answering your questions - I was using All Users (Default
User)/Startup
items to launch batch files and import .reg files. I used
RunOnceEx/RunOnce/Run only to register (launch) all user specifics.
You may also use many useful utilities from XP (Win2000) Resource Kit
including cals, cusermgr, ntrights, etc to help yourself to automate the
procedure.
KM,
BSquare Corp.
i had the same solution in my mind
but do you how do you let that bat-file be executed?
- do you let execute the right bat files yourself ?
- or by setting it in a RunOnceEx key?
and in the second case, in which registry key do you set the
right RunOnces for different users?
thanks in advance !!!!
Defcon31,
I had a similar problem and I fixed that by using Autologon feature
and
a
set of batch files that set up necessary registry, desktop shortcuts
and
etc. on first account logons. The implementation required a few
logoff/logons after FBA was finished. The final batch file was
cleaning
up
all temporary files/settings from device and leaving necesary logon
settings.
KM,
Bsquare Corp.
hello,
i have an administrator account and two user accounts.
1)how can i set a different wallpaper for each of them?
2)how can i create different desktop shortcuts for them?
anyone has experience with this so that everything is being fixed
during
FBA.
thanks in advance