Solved RunOnceEX is no longer executed


DMD

Well-known member
Member
Local time
7:15 AM
Posts
130
OS
W11
Good morning.
I am struggling with a strange RunOnceEx situation.
I have been using this procedure for years from W7 up to W11 22H2 and it works regularly on both HOST PC and virtual machine, but these days an unexplainable thing happens to me.
When I run this procedure on a newly built pc with Ryzen 9 7950X and still running W11 22H2, the RunOceEx does not run, when I try the same ISO with RunOnceEx on another PC or virtual machine it runs.
I have been going crazy for a few days and can't figure out why and don't know what solution to look for.
Any ideas?
This is the "setupcomplete.cmd" script that I have always uitilized.

Screenshot-003.png


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=%%

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%\06 /VE /D "Calculator Legacy" /f  >NUL
REG ADD %KEY%\06 /V 1 /D "%CDROM%\Software\Calculator_Legacy_2.0.exe" /f  >NUL

REG ADD %KEY%\07 /VE /D "7-Zip 22.01" /f  >NUL
REG ADD %KEY%\07 /V 1 /D "%CDROM%\Software\7z2201.msi /quiet /norestart" /f  >NUL

EXIT

Sincerely thank you
 

My Computer

System One

  • OS
    W11
    Computer type
    PC/Desktop
    CPU
    CPU AMD Ryzen 9 7950X
    Motherboard
    ASUS ROG Strix X670E-F Gaming WiFi
    Memory
    G.Skill Flare X5 32GB Kit DDR5-6000 CL32 (F5-6000J3238F16GX2-FX5)
    Monitor(s) Displays
    LG E2381VR
    Screen Resolution
    1920x1080
    Hard Drives
    1x Samsung Memorie MZ-V8P1T0B 980 PRO SSD 1TB
    2x Western Digital WD Red Nas 4TB
    PSU
    SEASONIC FOCUS PX-850 Plus Platinum
    Case
    Corsair 4000D Airflow
    Cooling
    ARCTIC Liquid Freezer II 280 A-RGB
    Keyboard
    Logitech G510
    Mouse
    Logitech G502 HERO
    Browser
    Firefox
    Antivirus
    Avg free
    Other Info
    Download: 90 Mbps
    Upload: 20Mbps
@DMD
Did not work for me either until I changed

Code:
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=%%
to
Code:
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:
 

My Computers

System One System Two

  • OS
    Win11 All /Debian/Arch
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & ADSL Bouygues -fr
    Browser
    Edge Canary- Firefox Nightly
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 12
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
THANK YOU.
i tried the correct script
Code:
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:
Unfortunately I still have the same problem.
 

My Computer

System One

  • OS
    W11
    Computer type
    PC/Desktop
    CPU
    CPU AMD Ryzen 9 7950X
    Motherboard
    ASUS ROG Strix X670E-F Gaming WiFi
    Memory
    G.Skill Flare X5 32GB Kit DDR5-6000 CL32 (F5-6000J3238F16GX2-FX5)
    Monitor(s) Displays
    LG E2381VR
    Screen Resolution
    1920x1080
    Hard Drives
    1x Samsung Memorie MZ-V8P1T0B 980 PRO SSD 1TB
    2x Western Digital WD Red Nas 4TB
    PSU
    SEASONIC FOCUS PX-850 Plus Platinum
    Case
    Corsair 4000D Airflow
    Cooling
    ARCTIC Liquid Freezer II 280 A-RGB
    Keyboard
    Logitech G510
    Mouse
    Logitech G502 HERO
    Browser
    Firefox
    Antivirus
    Avg free
    Other Info
    Download: 90 Mbps
    Upload: 20Mbps
Before we go further, where is your installation media?
As you can see, mine is on G: using the corrected script.
Written to the registry correctly.

Screenshot 2023-01-23 143634.jpg

Using the original script I get this:
Screenshot 2023-01-23 144155.jpg
 

My Computers

System One System Two

  • OS
    Win11 All /Debian/Arch
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & ADSL Bouygues -fr
    Browser
    Edge Canary- Firefox Nightly
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 12
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
I also replaced install.wim by install.??? in case the file is .esd
 

My Computers

System One System Two

  • OS
    Win11 All /Debian/Arch
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & ADSL Bouygues -fr
    Browser
    Edge Canary- Firefox Nightly
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 12
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
The installation file and on USB stick , burned with RUFUS and the file is in "wim" format
 

My Computer

System One

  • OS
    W11
    Computer type
    PC/Desktop
    CPU
    CPU AMD Ryzen 9 7950X
    Motherboard
    ASUS ROG Strix X670E-F Gaming WiFi
    Memory
    G.Skill Flare X5 32GB Kit DDR5-6000 CL32 (F5-6000J3238F16GX2-FX5)
    Monitor(s) Displays
    LG E2381VR
    Screen Resolution
    1920x1080
    Hard Drives
    1x Samsung Memorie MZ-V8P1T0B 980 PRO SSD 1TB
    2x Western Digital WD Red Nas 4TB
    PSU
    SEASONIC FOCUS PX-850 Plus Platinum
    Case
    Corsair 4000D Airflow
    Cooling
    ARCTIC Liquid Freezer II 280 A-RGB
    Keyboard
    Logitech G510
    Mouse
    Logitech G502 HERO
    Browser
    Firefox
    Antivirus
    Avg free
    Other Info
    Download: 90 Mbps
    Upload: 20Mbps
Mine is also on a USB stick and the reg keys get created.
Did you check the reg to see if the keys get created?
(see above screenshots)

BTW, when you say 'it doesn't work'.
What do you expect to happen?
The script you provided is passive and does not execute anything and sets values only.
 

My Computers

System One System Two

  • OS
    Win11 All /Debian/Arch
    Computer type
    Laptop
    Manufacturer/Model
    ASUSTeK COMPUTER INC. TUF Gaming FX705GM
    CPU
    2.20 gigahertz Intel i7-8750H Hyper-threaded 12 cores
    Motherboard
    ASUSTeK COMPUTER INC. FX705GM 1.0
    Memory
    24428 Megabytes
    Graphics Card(s)
    Intel(R) UHD Graphics 630 / NVIDIA GeForce GTX 1060
    Sound Card
    Intel(R) Display Audio / Realtek(R) Audio
    Monitor(s) Displays
    Integrated Monitor (17.3"vis)
    Screen Resolution
    FHD 1920X1080 16:9
    Hard Drives
    2 SSD SATA/NVM Express 1.3
    WDS500G2B0A-00SM50 500.1 GB
    WDCSDAPNUW-1002 256 GB
    PSU
    19V DC 6.32 A 120 W
    Cooling
    Dual Fans
    Mouse
    MS Bluetooth
    Internet Speed
    Fiber 1GB Cox -us & ADSL Bouygues -fr
    Browser
    Edge Canary- Firefox Nightly
    Antivirus
    Windows Defender
    Other Info
    VMs of Windows 11 stable/Beta/Dev/Canary
    VM of XeroLinux- Arch based & Debian 12
  • Operating System
    Windows 11 Insider Canary
    Computer type
    Laptop
    Manufacturer/Model
    ASUS X751BP
    CPU
    AMD Dual Core A6-9220
    Motherboard
    ASUS
    Memory
    8 GB
    Graphics card(s)
    AMD Radeon R5 M420
    Sound Card
    Realtek
    Monitor(s) Displays
    17.3
    Screen Resolution
    1600X900 16:9
    Hard Drives
    1TB 5400RPM
Thank you very much for the valuable information, in the meantime I have performed numerous tests and installations, and found the cause and solution to the problem.
Since a few days to save the number usb sticks, I created the bootable usb stick not as I always did with RUFUS but with Ventoy so that I can put in more ISOs of operating systems and tools.
And it is precisely the usb pen created with Ventoy that does not allow me to run the RunOnceEx, the usb pen created with Rufus works without problems, maybe it interacts with the ISO, I don't know what to think.
 

My Computer

System One

  • OS
    W11
    Computer type
    PC/Desktop
    CPU
    CPU AMD Ryzen 9 7950X
    Motherboard
    ASUS ROG Strix X670E-F Gaming WiFi
    Memory
    G.Skill Flare X5 32GB Kit DDR5-6000 CL32 (F5-6000J3238F16GX2-FX5)
    Monitor(s) Displays
    LG E2381VR
    Screen Resolution
    1920x1080
    Hard Drives
    1x Samsung Memorie MZ-V8P1T0B 980 PRO SSD 1TB
    2x Western Digital WD Red Nas 4TB
    PSU
    SEASONIC FOCUS PX-850 Plus Platinum
    Case
    Corsair 4000D Airflow
    Cooling
    ARCTIC Liquid Freezer II 280 A-RGB
    Keyboard
    Logitech G510
    Mouse
    Logitech G502 HERO
    Browser
    Firefox
    Antivirus
    Avg free
    Other Info
    Download: 90 Mbps
    Upload: 20Mbps
Thank you very much for the valuable information, in the meantime I have performed numerous tests and installations, and found the cause and solution to the problem.
Since a few days to save the number usb sticks, I created the bootable usb stick not as I always did with RUFUS but with Ventoy so that I can put in more ISOs of operating systems and tools.
And it is precisely the usb pen created with Ventoy that does not allow me to run the RunOnceEx, the usb pen created with Rufus works without problems, maybe it interacts with the ISO, I don't know what to think.
Just some info about Ventoy. I did exactly the same with Rescuezilla iso on it. It would refuse to boot from as secure boot refused it. Creating the Rescuezilla bootable USB flash drive with Rufus and had no issues.
 

My Computers

System One System Two

  • OS
    Win 11 Pro & 🐥.
    Computer type
    Laptop
    Manufacturer/Model
    ASUS VivoBook
    CPU
    AMD Ryzen 7 3700U with Radeon Vega Mobile Gfx
    Motherboard
    ASUSTeK COMPUTER INC. X509DA (FP5)
    Memory
    12GB
    Graphics Card(s)
    RX Vega 10 Graphics
    Monitor(s) Displays
    Generic PnP Monitor (1920x1080@60Hz)
    Screen Resolution
    1920x1080@60Hz
    Hard Drives
    Samsung SSD 970 EVO Plus 2TB NVMe 1.3
    Internet Speed
    25 Mbps
    Browser
    Edge
    Antivirus
    Defender
  • Operating System
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    ACER NITRO
    CPU
    AMD Ryzen 7 5800H / 3.2 GHz
    Motherboard
    CZ Scala_CAS (FP6)
    Memory
    32 GB DDR4 SDRAM 3200 MHz
    Graphics card(s)
    NVIDIA GeForce RTX 3060 6 GB GDDR6 SDRAM
    Sound Card
    Realtek Audio. NVIDIA High Definition Audio
    Monitor(s) Displays
    15.6" LED backlight 1920 x 1080 (Full HD) 144 Hz
    Screen Resolution
    1920 x 1080 (Full HD)
    Hard Drives
    Samsung 970 Evo Plus 2TB NVMe M.2
    PSU
    180 Watt, 19.5 V
    Mouse
    Lenovo Bluetooth
    Internet Speed
    25 Mbps
    Browser
    Edge
    Antivirus
    Defender
I found the script solution to make the RunOnceEx procedure work on Ventoy as well.
It involves synthesizing the "Software" folder in the Windows directoty
and then when the Windows installation is finished, when you enter the user name via the registry the programs in the "Software" folder are installed and when it finishes all the installations, the "Software" folder is deleted.

Setupcomplete
Code:
@echo off

SET CDROM=%WINDIR%\Setup

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%\06 /VE /D "Calcolatrice Legacy" /f  >NUL
REG ADD %KEY%\06 /V 1 /D "%CDROM%\Software\Calcolatrice_Legacy_2.0.exe" /f  >NUL

REG ADD %KEY%\42 /VE /D "Deleting Setup folder" /f  >NUL
REG ADD %KEY%\42 /V 1 /D "%CDROM%\Software\Deleting Setup folder.bat" /f  >NUL

EXIT

Deleting_Setup_folder
Code:
echo off
cls

rem -----Deleting_Setup_folder--------
rd "%windir%\Setup" /S /Q

exit
Also very important thing the structure of the ISO, the folder "Software" should be placed inside the folder "SETUP"

Senza-titulo-1.png
 

My Computer

System One

  • OS
    W11
    Computer type
    PC/Desktop
    CPU
    CPU AMD Ryzen 9 7950X
    Motherboard
    ASUS ROG Strix X670E-F Gaming WiFi
    Memory
    G.Skill Flare X5 32GB Kit DDR5-6000 CL32 (F5-6000J3238F16GX2-FX5)
    Monitor(s) Displays
    LG E2381VR
    Screen Resolution
    1920x1080
    Hard Drives
    1x Samsung Memorie MZ-V8P1T0B 980 PRO SSD 1TB
    2x Western Digital WD Red Nas 4TB
    PSU
    SEASONIC FOCUS PX-850 Plus Platinum
    Case
    Corsair 4000D Airflow
    Cooling
    ARCTIC Liquid Freezer II 280 A-RGB
    Keyboard
    Logitech G510
    Mouse
    Logitech G502 HERO
    Browser
    Firefox
    Antivirus
    Avg free
    Other Info
    Download: 90 Mbps
    Upload: 20Mbps
Back
Top Bottom