Many people like to add "Reg Tweaks" to their custom Win 7.iso, and use either OOBE.cmd or SetupComplete.cmd to do so ... but, reg tweaks for HKEY_CURRENT_USER cannot be applied from those .cmds during windows installation, as both cmd's auto run before that particular registry hive is loaded, ... a runonce cmd is alternative to apply HKCU reg tweaks IMPORTANT:- if you use SetupComplete.cmd to call an early reboot; then this is not for you (runonce would not apply); otherwise you could set up runonce for your needs like the following example 1. OOBE.cmd ... add this line of code to this .cmd Code: IF EXIST %windir%\HKCU.vbs ( reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v Run1 /t REG_SZ /d "%windir%\HKCU.vbs" /f >nul ) 2. HKCU.vbs ... save the following code as this .vbs Code: CreateObject("Wscript.Shell").Run "HKCU.cmd",0,True 3. HKCU.cmd ... save the following code as this .cmd Code: @echo off IF EXIST %windir%\HKCU.reg ( TAKEOWN /F %windir%\HKCU.reg >nul ICACLS %windir%\HKCU.reg /GRANT *S-1-1-0:F >nul START /W regedit /s %windir%\HKCU.reg >nul DEL /F /Q %windir%\HKCU.reg >nul ) IF EXIST %windir%\HKCU.vbs ( TAKEOWN /F %windir%\HKCU.vbs >nul ICACLS %windir%\HKCU.vbs /GRANT *S-1-1-0:F >nul DEL /F /Q %windir%\HKCU.vbs >nul ) DEL /F /Q %0% >nul 4. HKCU.reg ... add your HKCU tweaks to this file Now you have created 3xfiles HKCU.vbs...HKCU.cmd...HKCU.reg 5. ...copy those 3xfiles to the $$ folder contained inside your $oem$ folder Done. During install those 3xfiles will be auto copied to Windows directory, and the edited OOBE.cmd will add entry to registry for HKCU.vbs to run at runonce .... HKCU.vbs will make HKCU.cmd run without any black pop-up box ... HKCU.cmd will apply HKCU.reg.... and delete those files, and itself upon completion. This post at request of ALPHAWAVES
Thanks for this info so my HKCU.reg file is to look like this? Code: :IE Registrty Add echo Adding IE Registry Setting REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /V "DisableFirstRunCustomize" /T "REG_DWORD" /D "1" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /V "Check_Associations" /T "REG_SZ" /D "NO" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /V "Friendly http errors" /T "REG_SZ" /D "NO" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /V "Show image placeholders" /T "REG_DWORD" /D "1" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /V "Start Page" /T "REG_SZ" /D "www.google.co.uk" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /V "UseSWRender" /T "REG_DWORD" /D "1" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PhishingFilter" /V "EnabledV9" /T "REG_DWORD" /D "0" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes" /V "DefaultScope" /T "REG_SZ" /D "{52ADEEAA-7118-4D93-944B-4C284B1DD322}" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes" /V "DownloadUpdates" /T "REG_DWORD" /D "0" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{52ADEEAA-7118-4D93-944B-4C284B1DD322}" /V "DisplayName" /T "REG_SZ" /D "Google" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{52ADEEAA-7118-4D93-944B-4C284B1DD322}" /V "URL" /T "REG_SZ" /D "http://www.google.com/search?q={searchTerms}&rls=com.microsoft:{language}&ie={inputEncoding}&oe={outputEncoding}&startIndex={startIndex?}&startPage={startPage}" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing" /V "Groups" /T "REG_DWORD" /D "0" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing" /V "NewTabNextToCurrent" /T "REG_DWORD" /D "0" /F REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing" /V "NewTabPageShow" /T "REG_DWORD" /D "0" /F
Please could you help me here, this is my reg file, and it does not work... Code: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] "/V "EnableLUA" /T "REG_DWORD" /D "0" /F [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main] "DisableFirstRunCustomize"=dword:00000001 "Check_Associations"="no" "Friendly http errors"="no" "Show image placeholders"=dword:00000001 "Start Page"="http://www.google.co.uk/" "UseSWRender"=dword:00000001 [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PhishingFilter] "EnabledV9"=dword:00000000 [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes] "DefaultScope"="{52ADEEAA-7118-4D93-944B-4C284B1DD322}" "DownloadUpdates"=dword:00000000 [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\{52ADEEAA-7118-4D93-944B-4C284B1DD322}] "DisplayName"="Google" "URL"="http://www.google.com/search?q={searchTerms}&rls=com.microsoft:{language}&ie={inputEncoding}&oe={outputEncoding}&startIndex={startIndex?}&startPage={startPage}" [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TabbedBrowsing] "Groups"=dword:00000000 "NewTabNextToCurrent"=dword:00000000 "NewTabPageShow"=dword:00000000 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore] "DisableSR"=dword:00000001 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sr] "Start"=dword:00000004 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\sr\Parameters] "FirstRun"=dword:00000001 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\srservice] "Start"=dword:00000004
@NICK@NUMBER11... the 1st entry you have added to reg file is wriitten for .cmd install and cannot be added to a .reg file in the way it's been added. can you upload the OOBE.cmd and setupcomplete.cmd from your $oem$ folder?
Ok thanks OOBE.cmd is Code: @echo off start /w regedit /s %systemroot%\setup\scripts\OEMInformation.reg del /F /Q %systemroot%\setup\scripts\OEMInformation.reg call %systemroot%\setup\scripts\slp.cmd del /F /Q %systemroot%\setup\scripts\slp.cmd IF EXIST %windir%\HKCU.vbs ( reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v Run1 /t REG_SZ /d "%windir%\HKCU.vbs" /f >nul ) and setupcomplete is Code: @echo off ::Begin hotfix install :Windows Update echo Installing Windows Updater for future updates start /wait wusa.exe %WINDIR%\Setup\Scripts\windows6.1-kb2533552.msu /quiet /norestart /nobackup :Malicious software removal tool echo Installing Malicious Software Removal Tool start /wait %WINDIR%\Setup\Scripts\windows-kb890830-v4.3.exe /q :Misc apps echo Installing Miscellaneous Apps start /wait %WINDIR%\Setup\Scripts\Silverlight.exe /q :Defender Definitions echo Installing Windows Defender Definition updates start /wait %WINDIR%\Setup\Scripts\mpas-fe.exe /Q :NET Framework 4 echo Installing .NET 4 Framework start /wait %WINDIR%\Setup\Scripts\dotNetFx40_Full_x86_x64_SlimSetup.exe /aic ::all processing finished, delete used files, and EXIT:: :CLEANUP IF EXIST %windir%\Setup\scripts RD /S /Q %windir%\Setup\scripts >nul DEL /F /Q %0% >nul exit
@NICK@NUMBER11... attached file contains $oem$ folder with edited OOBE.cmd... and $$ folder contains HKCU.vbs, HKCU.cmd, and HKCU.reg.
Thanks so much I see that you have placed the HKCU files in the setup folder, thought i would need to put them into setup\scripts folder
no worries, the 3x HKCU files are just to be added in $$ folder, not in the Setup or the scripts folders... they self delete from Windows folder after completion.
Ok all worked, but the diable system restore did not, maybe something wrong with the code? Was thinking of using ths vbscript (as this works), whats the best way to call it? Code: Set fso = CreateObject("Scripting.FileSystemObject") Set lDrives = fso.drives Set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore") For Each d In lDrives If d.DriveType = 2 Then SRP.disable(d.Path & "\") Next
I don't think that would work... I use an Autounattend.xml to apply some settings including system restore, but I think if you edit your OOBE.cmd as follows, it will suit your needs:- OOBE.cmd Code: @echo off ::runonce if exist %windir%\HKCU.vbs reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v Run1 /t REG_SZ /d "%windir%\HKCU.vbs" /f >nul ::uac disable reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "EnableLUA" /t REG_DWORD /d "0" /f >nul ::When you manually disable system restore through GUI this key is set to 0 reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v RPSessionInterval /t REG_DWORD /d 0 /f >nul ::To delete information about systems volumes reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients" /f >nul ::To re-create a clean key with no volume info. reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SPP\Clients" /f >nul ::oem start /w regedit /s %systemroot%\setup\scripts\OEMInformation.reg >nul del /F /Q %systemroot%\setup\scripts\OEMInformation.reg >nul call %systemroot%\setup\scripts\slp.cmd >nul del /F /Q %systemroot%\setup\scripts\slp.cmd >nul
One last question, what the best place to enter the code to restart the PC. as i have added some further tweaks and need to do a restart for them to take place. do i enter it in the reg file or oobe???
@NICK@NUMBER11... restart:- 1.never add restart instruction to OOBE.cmd, as your Windows installation is not finalized at this stage of install. 2.never add restart instruction to SetupComplete.cmd, when you have a "runonce" instruction you need to apply, the reboot instruction would apply, and runonce instruction would not occur. workaround... add entries from setupcomplete.cmd to HKCU.cmd, plus restart instruction, and delete setupcomplete.cmd from scripts folder.
@ searchengine: Should I try this workaround method for my issue below?... add entries from setupcomplete.cmd to HKCU.cmd, plus restart instruction, and delete setupcomplete.cmd from scripts folder. Okay, I've tried this method and loved it. But when I actually put it into play on a real system (I say real cause when I tried the this method it worked like it should on a vmware, but on a real system it didn't.) My SetupComplete.cmd Code: @echo off ::check activation status, and exit:: WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE LicenseStatus=1 GET LicenseStatus | findstr "1" >nul IF ERRORLEVEL 1 goto :NOT_LICENSED RD /S /Q "%WINDIR%\Setup\Scripts" >nul DEL /F /Q %0% >nul EXIT ::run loader, if not activated:: :NOT_LICENSED %~dp0"Windows Loader.exe" /silent /preactivate >nul cd %~dp0 attrib -R -A -S -H *.* DEL /F /Q %~dp0"Windows Loader.exe" >nul SHUTDOWN /R /T 25 DEL /F /Q %0% >nul HKCU.cmd Code: @echo off IF EXIST %windir%\HKCU.reg ( TAKEOWN /F %windir%\HKCU.reg >nul ICACLS %windir%\HKCU.reg /GRANT *S-1-1-0:F >nul START /W regedit /s %windir%\HKCU.reg >nul DEL /F /Q %windir%\HKCU.reg >nul ) IF EXIST %windir%\HKCU.vbs ( TAKEOWN /F %windir%\HKCU.vbs >nul ICACLS %windir%\HKCU.vbs /GRANT *S-1-1-0:F >nul DEL /F /Q %windir%\HKCU.vbs >nul ) MSG * Installing extra programs, this could take a while... start /wait %WINDIR%\Setup\Scripts\mseinstall.exe /s /runwgacheck /o start /wait %WINDIR%\Setup\Scripts\DefUpdate.exe /q start /wait %WINDIR%\Setup\Scripts\Silverlight.exe /q start /wait %WINDIR%\Setup\Scripts\install_flash_player_10.exe -install start /wait %WINDIR%\Setup\Scripts\7z920.exe /S start /wait %WINDIR%\Setup\Scripts\ccsetup313.exe /S start /wait %WINDIR%\Setup\Scripts\jre-6u30-windows-i586-s.exe /s start /wait %WINDIR%\Setup\Scripts\vlc-1.1.11-win32.exe /S start /wait %WINDIR%\Setup\Scripts\SetupImgBurn_2.5.6.0.exe /S start /wait %WINDIR%\Setup\Scripts\ChromeStandaloneSetup.exe /silent /install MSG * Finished installing programs, enjoy! DEL /F /Q %0% >nul Whats not working is the HKCU i think, I say that cause for some reason when installing using this method in a custom ISO on my laptop the registry edits worked like they should and then the silent installers should run but they don't, When the computer had finished doing all it had to and I was on the desktop, my registry tweeks were in place but the apps were not installed. However, while in VMWARE on the same laptop, using the files above, I was able to install everything correctly, apps included- there was this little section of time during the setup finishing steps the theme looked like windows classic, my msg showed, the apps installed silently and then the last msg showed. While re-reading the post about the method I seen that if setupcomplete has a early reboot then this method wasn't for you. But before re-reading it I hadn't removed the line "SHUTDOWN /R /T 25" from setupcomplete and I still haven't cause I am not able to test it right now. File dir listing
Forgot to add in earlier post so Ill ask here, does this method work with x64 bit as well? I can't think of a reason it wouldn't but who knows.
@Humphrey... yep, you pretty much have identified the errors... The setupcomplete.cmd reboot instruction, kills runonce. Yes, I would move setupcomplete.cmd entries to (the bottom of) HKCU.cmd, and delete setupcomplete.cmd from scripts folder... I would also remove both Msg * line entries; + specify full path to "Windows Loader", and your HKCU.cmd would be as follows:- HKCU.cmd Code: @echo off IF EXIST %windir%\HKCU.reg ( TAKEOWN /F %windir%\HKCU.reg >nul ICACLS %windir%\HKCU.reg /GRANT *S-1-1-0:F >nul START /W regedit /s %windir%\HKCU.reg >nul DEL /F /Q %windir%\HKCU.reg >nul ) IF EXIST %windir%\HKCU.vbs ( TAKEOWN /F %windir%\HKCU.vbs >nul ICACLS %windir%\HKCU.vbs /GRANT *S-1-1-0:F >nul DEL /F /Q %windir%\HKCU.vbs >nul ) start /wait %WINDIR%\Setup\Scripts\mseinstall.exe /s /runwgacheck /o start /wait %WINDIR%\Setup\Scripts\DefUpdate.exe /q start /wait %WINDIR%\Setup\Scripts\Silverlight.exe /q start /wait %WINDIR%\Setup\Scripts\install_flash_player_10.exe -install start /wait %WINDIR%\Setup\Scripts\7z920.exe /S start /wait %WINDIR%\Setup\Scripts\ccsetup313.exe /S start /wait %WINDIR%\Setup\Scripts\jre-6u30-windows-i586-s.exe /s start /wait %WINDIR%\Setup\Scripts\vlc-1.1.11-win32.exe /S start /wait %WINDIR%\Setup\Scripts\SetupImgBurn_2.5.6.0.exe /S start /wait %WINDIR%\Setup\Scripts\ChromeStandaloneSetup.exe /silent /install ::check activation status, and exit:: WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE LicenseStatus=1 GET LicenseStatus | findstr "1" >nul IF ERRORLEVEL 1 goto :NOT_LICENSED RD /S /Q "%WINDIR%\Setup\Scripts" >nul DEL /F /Q %0% >nul EXIT ::run loader, if not activated:: :NOT_LICENSED call "%WINDIR%\Setup\Scripts\Windows Loader.exe" /silent /preactivate >nul cd %WINDIR%\Setup\Scripts attrib -R -A -S -H *.* DEL /F /Q "%WINDIR%\Setup\Scripts\Windows Loader.exe" >nul RD /S /Q "%WINDIR%\Setup\Scripts" >nul SHUTDOWN /R /T 25 DEL /F /Q %0% >nul ps - make sure, runonce instruction is added to OOBE.cmd Code: if exist %windir%\HKCU.vbs reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v Run1 /t REG_SZ /d "%windir%\HKCU.vbs" /f >nul edit: yep, 32+64bit instead of cmd window pop-ups, or message boxes to display a message of what's happening|installing, I use this little application to install my programs from "runonce" Desktop, and display install messages|progress InstallTips
Thnx SearchEngine, I will be testing this in about an hour or so in VMWARE. Once I've done that and it worked I will run it for real on a system and then get back with you/the board on how that turned out. The Installtips program, I gave it a quick read over and it looks like id just my programs to install to it like so: HKCU.cmd Code: @echo off IF EXIST %windir%\HKCU.reg ( TAKEOWN /F %windir%\HKCU.reg >nul ICACLS %windir%\HKCU.reg /GRANT *S-1-1-0:F >nul START /W regedit /s %windir%\HKCU.reg >nul DEL /F /Q %windir%\HKCU.reg >nul ) IF EXIST %windir%\HKCU.vbs ( TAKEOWN /F %windir%\HKCU.vbs >nul ICACLS %windir%\HKCU.vbs /GRANT *S-1-1-0:F >nul DEL /F /Q %windir%\HKCU.vbs >nul ) start /wait %WINDIR%\Setup\Scripts\InstallTips.exe ::check activation status, and exit:: WMIC /NAMESPACE:\\root\CIMV2 PATH SoftwareLicensingProduct WHERE LicenseStatus=1 GET LicenseStatus | findstr "1" >nul IF ERRORLEVEL 1 goto :NOT_LICENSED RD /S /Q "%WINDIR%\Setup\Scripts" >nul DEL /F /Q %0% >nul EXIT ::run loader, if not activated:: :NOT_LICENSED call "%WINDIR%\Setup\Scripts\Windows Loader.exe" /silent /preactivate >nul cd %WINDIR%\Setup\Scripts attrib -R -A -S -H *.* DEL /F /Q "%WINDIR%\Setup\Scripts\Windows Loader.exe" >nul RD /S /Q "%WINDIR%\Setup\Scripts" >nul SHUTDOWN /R /T 25 DEL /F /Q %0% >nul InstallTips.ini (yes, I skipped notification for defupdates.exe) Code: [COMMANDS]0=mseinstall.exe /s /runwgacheck /o 1=ChromeStandaloneSetup.exe /silent /install 2=install_flash_player_10.exe -install 3=ccsetup313.exe /S 4=7z920.exe /S 5=DefUpdate.exe /q 6=SetupImgBurn_2.5.6.0.exe /S 7=vlc-1.1.11-win32.exe /S 8=jre-6u30-windows-i586-s.exe /s 9=Silverlight.exe /q [InstallTips] 0=Installing: Microsoft Security Essentials 1=Installing: Google Chrome 2=Installing: Adobe Flash Player 3=Installing: Ccleaner 4=Installing: 7-Zip 6=Installing: ImgBurn 7=Installing: VLC Media Player 8=Installing: Java 9=Installing: Silverlight Should I used the full path for the [COMMANDS] lines in the installtips ini?
Hey great idea, going to use the installTips also, guess all the files need to be in the same folder as the programs wanting to be installed, and in the sources\$oem$\$$ or in scripts?
@ NICK@NUMBER11 I'd like to say that the installtips.exe goes into the "sources\$oem$\$$\Setup\scripts" directory and you run it from HKCU.cmd. I will be testing this here shortly.