darks0ul Posted December 18, 2011 Share 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? Link to comment Share on other sites More sharing options...
allen2 Posted December 18, 2011 Share 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". Link to comment Share on other sites More sharing options...
darks0ul Posted December 18, 2011 Author Share 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. Link to comment Share on other sites More sharing options...
allen2 Posted December 18, 2011 Share 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. Link to comment Share on other sites More sharing options...
myselfidem Posted December 18, 2011 Share Posted December 18, 2011 Useful tip and info:http://forums.mydigitallife.info/threads/24892-Batch-OEM-HKEY_CURRENT_USER-Reg-Tweaks Link to comment Share on other sites More sharing options...
darks0ul Posted December 18, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
myselfidem Posted December 21, 2011 Share 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 Link to comment Share on other sites More sharing options...
darks0ul Posted December 21, 2011 Author Share 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. Link to comment Share on other sites More sharing options...
myselfidem Posted December 22, 2011 Share 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 Link to comment Share on other sites More sharing options...
Schiiwa Posted January 4, 2014 Share 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 Link to comment Share on other sites More sharing options...
Schiiwa Posted January 4, 2014 Share 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 Link to comment Share on other sites More sharing options...
myselfidem Posted January 4, 2014 Share Posted January 4, 2014 Thanks Schiiwa ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now