[W10 V20H2] Does not run Runonce EX


  1. DMD
    Posts : 86
    W10 Pro 64 bit 21H1
       #1

    [W10 V20H2] Does not run Runonce EX


    Good morning.
    For a few months, I have been testing on a virtual machine to integrate some tools into the ISO of Windows using the former runonce procedure used for years, but I can't make it run, I checked the scripts and they are all ok. Then to not waste time to install the ISO every time to see if it is executed directly the "setupcomplete.cmd" script directly and the log key is created with the launch programs in the path "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEX ". But when the system restarts the programs are not executed.
    Some idea?
    Cordially thank you
    Last edited by DMD; 18 Apr 2021 at 11:00.
      My Computer


  2. Posts : 4,187
    Windows 11 Pro, 22H2
       #2

    DMD, I don't know what your entire procedure looks like, but in my case I use a "runonce.bat" that works just fine.

    The runonce.bat should be placed in the following location:

    C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    NOTE: AppData may be hidden depending upon your settings. To navigate to this path, open explorer, type in %appdata% in the address bar and hit Enter. You can then navigate the rest of the path.

    As for SetupComplete.cmd:

    Place the file in this location:

    %WINDIR%\Setup\Scripts\SetupComplete.cmd Order of Operations

    1. After Windows is installed but before the logon screen appears, Windows Setup searches for the SetupComplete.cmd file in the %WINDIR%\Setup\Scripts\ directory.

    2. If a SetupComplete.cmd file is found, Windows Setup runs the script. Windows Setup logs the action in the C:\Windows\Panther\UnattendGC\Setupact.log file.

    Setup does not verify any exit codes or error levels in the script after it executes SetupComplete.cmd.

    Warning: You cannot reboot the system and resume running SetupComplete.cmd. You should not reboot the system by adding a command such as shutdown -r. This will put the system in a bad state.

    3. If the computer joins a domain during installation, the Group Policy that is defined in the domain is not applied to the computer until Setupcomplete.cmd is finished. This is to make sure that the Group Policy configuration activity does not interfere with the script.

    If this does not help, please provide some more specific details and I'll see if I can offer any assistance.
      My Computers


  3. DMD
    Posts : 86
    W10 Pro 64 bit 21H1
    Thread Starter
       #3

    Good morning and thank you for your attention. To simulate the operation of RunonceEx in the ISO, I followed the advice to enter the "setupcomplete.cmd" script in the path
    "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
    I restarted the system, but the programs are not executed. This is the example script:
    Code:
     echo off
    
    for %%w IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%w:\sources\install.wim SET CDROM=%%w:
    
    REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    
    REG ADD %KEY% /v Flags /t REG_DWORD /d "20" /f
    
    REG ADD %KEY% /V Title /D "Post Installation..." /f  >NUL
    
    REG ADD %KEY%\02 /VE /D "7-Zip_19.00" /f  >NUL
    REG ADD %KEY%\02 /V 1 /D "%CDROM%\Software\7z1900-x64.msi /quiet /norestart" /f  >NUL
    
    EXIT
    Last edited by DMD; 19 Apr 2021 at 07:08.
      My Computer


  4. Posts : 4,187
    Windows 11 Pro, 22H2
       #4

    How are you creating your ISO image? Are you setting up a reference system, performing a sysprep on it and then capturing the image?
      My Computers


  5. DMD
    Posts : 86
    W10 Pro 64 bit 21H1
    Thread Starter
       #5

    Maybe I expressed myself badly and I apologize I have no problem creating the ISO with the ImageX Sysprep procedure. The problem is in the execution only of some files with the RunonceEx procedure, the other files are executed regularly. To make the faster tests, I want to avoid opening the ISO enter RunonceEx files and install a lot of time on a virtual machine. If you can test RunonceEx files in the virtual machine to restart, avoiding the long installation time. I would like to use this faster method, to verify that you have a problem that has been working hard to solve. The problem concerns a file in batch format that launches a series of registry keys that are not activated, but only this is the problem other files in silent format I am executed regularly. The specific SetupComplete script is this:
    Code:
    echo off
    
    for %%w IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%w:\sources\install.wim SET CDROM=%%w:
    
    REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
    
    REG ADD %KEY% /v Flags /t REG_DWORD /d "20" /f
    
    REG ADD %KEY% /V Title /D "Post Installation..." /f  >NUL
    
    REG ADD %KEY%\20 /VE /D "Tweak_reg_W10_Additional_features" /f  >NUL
    REG ADD %KEY%\20/V 1 /D "%CDROM%\Software\Tweak_reg_W10_Additional_features\Install.bat" /f  >NUL
    
    EXIT
    The folder containing i registry file it's this one:

    Folder... Software\Tweak_reg_W10_Additional_features Inside the folder inside which these files are present:




    The "Install.bat" launch file is this :
    Code:
    @echo off
    :CheckPrivileges
    net session >nul 2>&1
    if not %ErrorLevel% == 0 (
            color 4f    
            echo.        
            echo ESEGUIRE IL FILE CON I PRIVILEGI DI AMMINISTRATORE
        echo.
        echo                Uscita in corso...
        rem Delay di uscita dallo script    
        PING 127.0.0.1 > NUL 2>&1
            goto End
    )
    
    cls
    Color 1f
    echo ==========================================
    echo.
    echo    Tweak di Registro per Windows 10
    echo       Additional features 
    echo.
    echo ==========================================
    echo.
    echo             Attendere...
    regedit /S Add_Control_Panel_to_desktop_context_menu_large_icon.reg
    regedit /S Aggiungere_comandi_COPIA_e_SPOSTA.reg
    regedit /S Apri_con_notepad.reg
    regedit /S Attivita_Disable.reg
    regedit /S Blocco_note_menu_context.reg
    regedit /S Caselle_selezione_file_off.reg
    regedit /S Controllo_completo_file.reg
    regedit /S Disabilita_suggerimenti_in_Start.reg
    regedit /S Disabilitare_avvisi_di_sicurezza_quando_si_eseguono_file.reg
    regedit /S Disable_App_Backround.reg
    
    exit
      My Computer


  6. Posts : 4,187
    Windows 11 Pro, 22H2
       #6

    LOL. I think that we are having a little bit of a difficult time understanding each other.

    I know that you are not having difficulty creating the ISO image. My question was more about what you are using for an ISO image. You need to copy your files to the Window image somehow, right? So I'm wondering how you are doing this and how you are saving that image. I want to make sure you have the correct steps for that.

    Also, why are placing the SetupComplete.cmd file in "C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"? That is not the correct location for it.

    Here is the procedure I would suggest trying:

    NOTE: I'll try this when I have time, it's just not going to happen right now . I'm only providing a rough outline here, not all steps. Also, it looks to me like what you are trying to accomplish may not even need a SetupComplete.cmd. It may be far easier to simply incorporate this into a syspreped image, but I could be wrong here.

    Create your reference system.

    Make certain that you are booted into Audit Mode only as is customary for a system that will be Syspreped and generalized.

    Make your modification to te system settings as you see fit.

    Place the SetupComplete.cmd in the correct location (%WINDIR%\Setup\Scripts\).

    Sysprep / Generalize Windows

    Create your image of the syspreped installation.

    Incorporate the updated install.wim from your image into a new ISO image or physical media.

    Install Windows from that ISO or physical media.
      My Computers


  7. DMD
    Posts : 86
    W10 Pro 64 bit 21H1
    Thread Starter
       #7

    Thanks for your suggestions. Today I check the procedure and test.
      My Computer


  8. Posts : 4,187
    Windows 11 Pro, 22H2
       #8

    DMD, if I may, I would like to suggest the tutorial below. This is a fantastic way to create a completely customized Windows installation with all you registry changes already in place. You can also make other customizations, pre-install apps, and more. Then, when you install Windows, all those changes will already be present.

    Create media for automated unattended install of Windows 10

    Let me know if you have any questions or need any help. I would be happy to assist!
      My Computers


  9. DMD
    Posts : 86
    W10 Pro 64 bit 21H1
    Thread Starter
       #9

    Good morning. The procedure I have always used is to insert the RunonceEx sequence inside the ISO already modified with the SySprep Image Capture Method.
    With the RunonceEx procedure I can change the programs quickly by only by opening and closing the ISO.





    If the RunonceEx procedure instead can be inserted in the "Instal.vim" file I don't know how it proceeds I have never performed this procedure, maybe it is faster in installation.
    Last edited by DMD; 28 Apr 2021 at 01:13.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:13.
Find Us




Windows 10 Forums