darks0ul Posted December 18, 2011 Posted December 18, 2011 Hi,I have some .reg files with settings I'd like all the users to have and I'm trying to apply them in setupcomplete.cmd, so that the default account is modified and new accounts copy the settings from there.Here's my setupcomplete.cmd@echo onecho OK>>C:\setupcomplete.log:: Apply common HKCU tweaks to the default accountIF EXIST C:\Install\user_regtweaks_common.reg echo Exist user_regtweaks_common.reg>>C:\setupcomplete.logREGEDIT /S %SystemDrive%\Install\user_regtweaks_common.reg>>%SystemDrive%\setupcomplete.log:: Console tweaksIF EXIST C:\Install\console.reg echo Exist console.reg>>C:\setupcomplete.logREGEDIT /S C:\Install\console.reg>>C:\setupcomplete.logAfter setup is completed, setupcomplete.log containsOKExist user_regtweaks_common.regExist console.regDoes anybody know what's wrong?
allen2 Posted December 18, 2011 Posted December 18, 2011 If uac isn't turned off regedit command doesn't run. Perhaps that's why also i would replace "regedit" with "reg import".
darks0ul Posted December 18, 2011 Author Posted December 18, 2011 If uac isn't turned off regedit command doesn't run. Perhaps that's why also i would replace "regedit" with "reg import".UAC is off, I tried with reg import and I got the same results.If I manually run setupcomplete.cmd, it works.
allen2 Posted December 18, 2011 Posted December 18, 2011 Perhaps uac is turned off after the script is run or isn't turned of for the user running the script because "reg import" will always output something.Try with those tricks to bypass uac.
myselfidem Posted December 18, 2011 Posted December 18, 2011 Useful tip and info:http://forums.mydigitallife.info/threads/24892-Batch-OEM-HKEY_CURRENT_USER-Reg-Tweaks
darks0ul Posted December 18, 2011 Author Posted December 18, 2011 Perhaps uac is turned off after the script is run or isn't turned of for the user running the script because "reg import" will always output something.Try with those tricks to bypass uac.That didn't work Reg import outputs "operation completed successfully" or something alike.Useful tip and info:http://forums.mydigitallife.info/threads/24892-Batch-OEM-HKEY_CURRENT_USER-Reg-TweaksI'm afraid it's related to that, but it does not seem an elegant solution to me.Thanks for helping me out
myselfidem Posted December 21, 2011 Posted December 21, 2011 You can try adding registry keys like this example.Create your customized SetupComplete.cmd and your registry settings (User.reg and Console.reg) inside the folder:%SystemDrive%\Distribution_Folder\sources\$OEM$\$$\Setup\Scripts\Example:SetupComplete.cmd@echo offREG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExSET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExecho.REG ADD %KEY%\005 /V 1 /D "REGEDIT /S %SystemRoot%\Setup\Scripts\User.reg" /fecho.REG ADD %KEY%\010 /V 1 /D "REGEDIT /S %SystemRoot%\Setup\Scripts\Console.reg" /fexit
darks0ul Posted December 21, 2011 Author Posted December 21, 2011 I solved it by loading the default user registry:reg load HKU\LoadedDefaultUser "%SystemDrive%\Users\Default\ntuser.dat":: Apply common HKCU tweaks to the default accountREGEDIT /S %SystemDrive%\Install\user_regtweaks_common.reg:: Unload registry hivereg unload HKU\LoadedDefaultUserI thought that HKCU pointed to that hive, but I was wrong.
myselfidem Posted December 22, 2011 Posted December 22, 2011 (edited) Works fine also using "reg.exe import" (example):SetupComplete.cmd@echo offREG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExSET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\005 /V 1 /D "reg import "%SystemDrive%\Install\Tweaks.reg""exit Edited December 22, 2011 by myselfidem
Schiiwa Posted January 4, 2014 Posted January 4, 2014 I solved it by loading the default user registry:reg load HKU\LoadedDefaultUser "%SystemDrive%\Users\Default\ntuser.dat":: Apply common HKCU tweaks to the default accountREGEDIT /S %SystemDrive%\Install\user_regtweaks_common.reg:: Unload registry hivereg unload HKU\LoadedDefaultUserI thought that HKCU pointed to that hive, but I was wrong.Hey darks0ul...look to the thread @ mydigitallife again.... i just was there and now i found this thread xDBut you should have menioned, that the keys in the regfile have to be adapted to the hivefromHKEY_CURRENT_USER\BLABLAtoHKU\LoadedDefaultUser\BLABLACheers, Schiiwa
Schiiwa Posted January 4, 2014 Posted January 4, 2014 (edited) Works fine also using "reg.exe import" (example):SetupComplete.cmd@echo offREG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExSET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%\005 /V 1 /D "reg import "%SystemDrive%\Install\Tweaks.reg""exitThis would be more genteel if you want to have a variable anyway @echo offSET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY%REG ADD %KEY%\005 /V 1 /D "reg import "%SystemDrive%\Install\Tweaks.reg""exit Edited January 4, 2014 by Schiiwa
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now