[Batch] $OEM$ - HKEY_CURRENT_USER Reg Tweaks

Discussion in 'Scripting' started by searchengine, Feb 17, 2011.

  1. NICK@NUMBER11

    NICK@NUMBER11 MDL Expert

    Mar 23, 2010
    1,385
    650
    60
    Thanks, where are you putting all the programs to be installed in the same folder?

     
  2. searchengine

    searchengine Guest

    @Humphrey...

    Yes, you appear to have the right idea, how to add InstallTips...

    As long as InstallTips.exe and InstallTips.ini files are kept in the same folder as the programs you want to install, then no, you do not need to specify the full path to programs in the .ini file.... and yes, the easiest way is to have all those files in the "sources\$oem$\$$\setup\scripts" folder, and add instruction to run InstallTips.exe to HKCU.cmd (as you have done).

    One small thing, your InstallTips.ini file entry:-

    [COMMANDS]0=mseinstall.exe /s /runwgacheck /o

    make sure like below:-

    [COMMANDS]
    0=mseinstall.exe /s /runwgacheck /o

    all else looks ok.

    @NICK@NUMBER11...

    I hope above helps clarify for you also.
     
  3. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    I wrapped up a windows iso with the install tips in the scripts folder as I mentioned above and added the installtips.exe to the HKCU so that it would run. I tested it on a VMWARE and everything worked but calling the installtips.exe from scripts. So in the VMWARE i edited the HKCU.cmd and put it back into the windows dir and the installtips+apps into setup/scripts/ and ran the HKCU.cmd with this line: "start /wait %WINDIR%\Setup\Scripts\InstallTips.exe" - the cmd prompt showed for a bit then disappeared. I then re-wrote it as start /wait C:\Windows\Setup\scripts\installtips.exe but still nothing. I then went directly to the scripts folder with the installtips.exe and inf file and ran the installtips.exe but itself and the files started installing.

    I read on the website where I found the installtips app:
    and

    After writting the above I noticed that the creator recommends it to be wrote as "start /wait installtips.exe so I did it just like that. I placed a cmd file in the scripts folder and it ran. I believe that the install tips will have to be placed in the same folder as the HKCU and the installtips.inf program paths have to be full paths now. WIll test it and get back.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    #24 Humphrey, Dec 22, 2011
    Last edited by a moderator: Apr 20, 2017
    Im not sure what installtips.exe problem is but I tested out a few things and I figured out that installtips cannot be called (what reason idk) from any other directory with the cmd then the installertips is in, so what I am testing now is keeping the installertips+applications in the scripts folder, but modifying the HKCU.cmd to change dir to the scripts folder then run installertips.exe. Like so
    Code:
    cd "%WINDIR%\Setup\Scripts"
    start /wait InstallTips.exe

    EDIT:

    Okay, Tested out the new line and everything worked the way it should (On a VM, haven't tested on actual PC)

    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
    )
    
    
    cd "%WINDIR%\Setup\Scripts"
    start /wait InstallTips.exe
    cd\
    
    
    ::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
    DEL /F /Q %0% >nul

    I removed the shutdown line because it was causing the computer to shutdown before the Windows Customization prompt was still displaying when it wanted to restart thus not being able to finish that process, which ever it may be.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    @ searchengine


    Would you say that this method Windows 7 DVD [Multi-Brand|Multi-Edition] Activation (im using AIO-Win7-DVD-Activation-[incl.Daz_Loader]v2.10) is no good anymore? As in if I do install it on a 2.1 slic bios, it will work with the certificates? Do I need to update them or the keys? Is there a better way? I read somewhere this is for ppl that can't/don't want to integrate methods into the Install.WIM, can you point me in that direction?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. searchengine

    searchengine Guest

    @Humphrey...

    only been able to quickly look at your last few posts, as I have a few things I need to do today, I will get a better look a bit later today...but $oem$ method should be able to handle the stuff you want to install...get back to ya asap.
     
  7. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    Hey no rush man, my last few post are crazy and I have a weird sleep schedule, I am a night watchman. #23 & #24 are post where I was trying to get installtips.exe to work, but i've got it now. Just took a little bit of trial and error, it was so easy to fix once I figured it out. The only thing that it needs now is that shutdown line and I am not sure where to put it and Ill add other programs and such a latter time once this thing is bullet proof. As for post #25, like i said, no rush.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. magic12kenneth

    magic12kenneth MDL Novice

    Jul 11, 2008
    1
    0
    0
    #28 magic12kenneth, Dec 24, 2011
    Last edited by a moderator: Apr 20, 2017
    Hi,

    Instead of using the OOBE.cmd, can I use the SetupComplete.cmd to execute the OOBE.cmd's code using RunOnceEx? Because in my SetupComplete.cmd, I use the RunOnceEx to install three programs: Visual C++ Runtimes, IE9 and .NET Framework 4.0.

    SetupComplete.cmd

    Code:
    REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx
    SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    
    REG ADD %KEY% /V TITLE /D "Installing Applications" /f
    REG ADD %KEY%\01 /VE /D "NET Framworke 4.0" /f
    REG ADD %KEY%\01 /V 1 /D "%SystemDrive%\NetFramework4.exe" /f
    REG ADD %KEY%\02 /VE /D "VC Runtimes" /f
    REG ADD %KEY%\02 /V 1 /D "%SystemDrive%\Install\VCRuntimes.exe" /f
    REG ADD %KEY%\03 /VE /D "IE9" /f
    REG ADD %KEY%\03 /V 1 /D "%SystemDrive%\Install\IE9.exe" /f
    REG ADD %KEY%\04 /VE /D "HCKU" /f
    REG ADD %KEY%\04 /V 1 /D "%windir%\HKCU.vbs" /f >nul"
    
    Would this work? Also, I don't see a call from the SetupComplete.cmd to run the OOBE.cmd. Does that mean Windows Setup automatically execute the $OEM$\OOBE.cmd?
     
  9. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    #29 Humphrey, Dec 24, 2011
    Last edited by a moderator: Apr 20, 2017
    Honestly, I have no idea if that would work cause I am just getting into this sort of thing myself, how ever, I do know that you can use the HKCU.cmd to apply your programs by having them runonce as silent installers as I have here instead of having them runonce from the registry:

    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
    )
    
    
    cd "%WINDIR%\Setup\Scripts"
    start /wait InstallTips.exe
    cd\
    
    
    ::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
    DEL /F /Q %0% >nul
    
    
    Start /wait mseinstall.exe /s /runwgacheck /o
    Start /wait mpam-fe.exe /q
    Start /wait install_flash_player_10.exe -install
    Start /wait ccsetup313.exe /S
    Start /wait 7z920.exe /S
    Start /wait ChromeStandaloneSetup.exe /silent /install
    Start /wait SetupImgBurn_2.5.6.0.exe /S
    Start /wait vlc-1.1.11-win32.exe /S
    Start /wait jre-7u2-windows-i586.exe /s /v"/qn REBOOT=Suppress
    Start /wait Silverlight.exe /q
    Start /wait AdbeRdr1011_en_US.exe /msi EULA_ACCEPT=YES /qn
    As for oobe.cmd and it being called by setup, you know, I think that it does, as well as setupcomplete.cmd. (and those files will be in "$oem$\$$\Setup\scripts" not just in the $oem$ folder.

    As for your setupcomplete.cmd, I do not think thats how the registry commands are suppose to look. Here is how it should:
    Code:
    reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v Run1 /t REG_SZ /d "%windir%\HKCU.vbs" /f >nul
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. Master.Pirate

    Master.Pirate MDL Junior Member

    Aug 2, 2011
    73
    20
    0
    #30 Master.Pirate, Mar 12, 2012
    Last edited: Mar 12, 2012
    Can We Remove following registry Entry using Setupcomplete.cmd

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Service Pack Cleanup

     
  11. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    I read something a while back about registry hives not being loaded at specific points in the installation (and maybe once its had its first start (to the desktop)) so if you can find out if that hive (or tree) is loaded by the time setupcomplete is called then I say YES, it can, if not, then you will need to add something that adds a runonce command to delete that line.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. dont.know83

    dont.know83 MDL Novice

    Oct 27, 2012
    3
    1
    0
    Sorry Guys, but i think IT IS possible to add entries to HKCU with SetupComplete.cmd! :movingtongue:
    (Havent tryed out this method inside SETUPCOMPLETE.CMD yet, but i always look on the bright side)

    w w w . y o u t u b e . c o m /watch?v=jHPOzQzk9Qo
    (I just have 2 posts)

    In Fact, this is the way:
    First load the following file (Which represent the HKCU of new profiles) to the registry:
    C:\Users\Default\NTUSERS.DAT
    with this command:
    reg load "HKU\CurrentUsersDefault" "C:\Users\Default\NTUSER.DAT"
    you can also use variables like this:
    reg load "hku\CurrentUsersDefault" "%USERPROFILE%\..\Default User\NTUSER.DAT"

    Then add your wanted regkeys like this (dont forget to adapt your keys):
    for example:
    reg add "HKEY_CURRENT_USERS\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v Data /t Reg_SZ /d "Programm.exe"
    has to be changed to:
    reg add "hku\CurrentUsersDefault\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v Data /t Reg_SZ /d "Programm.exe"

    you can also do it via regedit
    The loaded hive can be found under HKEY_USERS:
    HKEY_USERS\CurrentUsersDefault

    When you are ready, do not forget to unload:
    reg unload "hku\CurrentUsersDefault"

    I haven't tryed it out, but i guess the editation of this file will also be possible inside Install.wim!
    Cheers, Schiiwa :shisha:
     
  13. KNARZ

    KNARZ MDL Addicted

    Oct 9, 2012
    896
    473
    30
    i used reg load in the past. so i can confirm that this works.
    now i'm using active setup (HKLM\Software\Microsoft\Active Setup\Installed Components). to import hkcu as this doesn't need changes to the file itself.

    downside: user account need to logoff/logon (reboot) to apply some changes (especially explorer settings).
     
  14. Bm.Lava

    Bm.Lava MDL Novice

    Nov 16, 2013
    46
    8
    0
    #34 Bm.Lava, Aug 6, 2016
    Last edited by a moderator: Apr 20, 2017
    This solution really helped me a lot. try every other method for the last two days and was driving crazy. But at last came here and wow! Thanks again.


    I need a little help as I don't understand the codes, but I added several DWORD value to the registry with the setupcomplete.cmd and those worked fine. Can't add these two values. Can anyone please correct me.

    Should be...
    Name: Bias
    Type: REG_DWORD
    Data: fffffe98

    Should be...
    Name: Description
    Type: REG_EXPAND_SZ
    Data: @%SystemRoot%\system32\powrprof.dll,-50,Take no action

    Or just help me to add custom cmd command for setupcomplete.cmd to add timezone of +6, that is "Bangladesh Standard Time". And 2nd is in the power option "close the lid will do nothing".

    I tried with this code but no luck...

    Code:
    ::change time zone::
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "Bias" /D "fffffe98" /T REG_DWORD /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "DaylightBias" /D "ffffffc4" /T REG_DWORD /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "DaylightName" /D "@tzres.dll,-1021" /T REG_SZ /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "DaylightStart" /D "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" /T REG_BINARY /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "StandardName" /D "@tzres.dll,-1022" /T REG_SZ /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "StandardStart" /D "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" /T REG_BINARY /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "TimeZoneKeyName" /D "Bangladesh Standard Time" /T REG_SZ /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "ActiveTimeBias" /D "fffffe98" /T REG_DWORD /F >NUL
    
    ::close lid do nothing::
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\PowerSettings\4f971e89-eebd-4455-a8de-9e59040e7347\5ca83367-6e45-459f-a27b-476b1d01c936\3" /V "Description" /D "@%SystemRoot%\system32\powrprof.dll,-50,Take no action" /T REG_EXPAND_SZ /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\PowerSettings\4f971e89-eebd-4455-a8de-9e59040e7347\5ca83367-6e45-459f-a27b-476b1d01c936\3" /V "FriendlyName" /D "@%SystemRoot%\system32\powrprof.dll,-51,Take no action" /T REG_EXPAND_SZ /F >NUL
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\PowerSettings\4f971e89-eebd-4455-a8de-9e59040e7347\5ca83367-6e45-459f-a27b-476b1d01c936\3" /V "SettingValue" /D "0" /T REG_DWORD /F >NUL
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. KNARZ

    KNARZ MDL Addicted

    Oct 9, 2012
    896
    473
    30
    #35 KNARZ, Aug 7, 2016
    Last edited by a moderator: Apr 20, 2017
    Code:
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" /V "Bias" /D "0xfffffe98" /T REG_DWORD /F >NUL
    Code:
    REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Power\PowerSettings\4f971e89-eebd-4455-a8de-9e59040e7347\5ca83367-6e45-459f-a27b-476b1d01c936\3" /V "Description" /D "@^%SystemRoot^%\system32\powrprof.dll,-50,Take no action" /T REG_EXPAND_SZ /F >NUL
    use tzutil.exe for timezone settings.
    use powercfg.exe for power settings.
     
  16. Bm.Lava

    Bm.Lava MDL Novice

    Nov 16, 2013
    46
    8
    0
    Thanks a lot. The first command worked perfectly and the second command gives me different value than I wanted. But thanks to you just googled and replaced %%SystemRoot%% and gives me the correct value. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. Bm.Lava

    Bm.Lava MDL Novice

    Nov 16, 2013
    46
    8
    0
    #37 Bm.Lava, Aug 8, 2016
    Last edited: Aug 8, 2016
    Thanks a ton. Those two tools really helped. I'm so grateful to you. Thanks again...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  18. v72dd

    v72dd MDL Senior Member

    Nov 20, 2016
    444
    77
    10
    How to properly modify HKCU with setupcomplete.cmd?

    Things like wallpaper, visual effects will not work..
     
  19. narcho

    narcho MDL Novice

    Apr 15, 2016
    1
    0
    0
    Hello I need a help to deploy a reg from the user software configuration after the first login and wanted it to default to new users created.

    Inside the install.wim in %Windir%\Setup\scripts will contain:
    Setupcomplete.cmd
    HKCU_config.cmd
    Activation-windows-xxx.cmd
    Clean.cmd

    My question is how to get HKCU_config.cmd to run after logging in and deleted the scripts folder only after logging in?