I believe I had a problem similar to yours: I needed to apply configuration settings to the registry that would affect all users at their first login (I didn't care if a user changed their preferences subsequently). I tried modify a temp user profile and overwrite the Default User profile as you had done -- this did not work for me. Also, for whatever reason, Run/RunOnce didn't provide what I needed either. This is what I did:
In the i386\$oem$
folder, create/modify cmdlines.txt
to execute batch.cmd
during minisetup:
[Commands]
"BATCH.CMD"
In the i386\$oem$
folder, create/modify batch.cmd
to use reg.exe
to mount the Default User's ntuser.dat
to an arbitrary mount point under HKEY_USERS
(I called mine HKU\DEFUSER
), import a *.reg file containing your desired registry settings, and then unmount. Here is what it might look like:
@echo off
REM *********************************************************************
REM Importing Registry Data into HKU\DEFUSER
REM *********************************************************************
echo Importing Registry Data into HKU\DEFUSER...
REG.EXE LOAD HKU\DEFUSER "C:\Documents and Settings\Default User\ntuser.dat"
REG.EXE IMPORT "HKU_DEFUSER Settings.reg"
REG.EXE UNLOAD HKU\DEFUSER
In the i386\$oem$
folder, create a *.reg file containing your desired registry settings. I called mine HKU_DEFUSER Settings.reg
. Make sure the key names in the *.reg file agree with what you named your mount point in batch.cmd
(Mine was DEFUSER):
Windows Registry Editor Version 5.00
[HKEY_USERS\DEFUSER\Control Panel\PowerCfg]
"CurrentPowerPolicy"="3"
Since cmdlines.txt
is executed near the end of minisetup, these settings will not be overwritten.
Note about Step 1: The Microsoft documentation says that cmdlines.txt
is parsed and then executed -- it's not a normal batch or command file. There can be some escaping concerns with complicated commands containing quotes, etc. The Microsoft-recommended method is just to have cmdlines.txt
execute a single batch file and place all the complicated things in the batch file.