Why does Post-Setup (After logon) not run my script on Win11 24H2?

ZorkLVM

Member
Messages
47
Reaction score
4
It runs just fine on Win10 with nearly identical autounattend.xml.

I added `00. Setup 1.bat` via Post-Setup > After-logon. Result = nothing.

So then I tried RunOnce. Result = nothing.

Edit: The Start menu popping up on first logon isn't the the problem, is it? When it pops up, it seems like it REALLY wants attention.

00. Setup 1. bat:

Code:
@echo off

setlocal enabledelayedexpansion

set "TAG=Setup"
set "LOGFILE=%PUBLIC%\Desktop\Setup Log.log"
set "SETUPPATH=%PUBLIC%\Desktop\Setup"

echo %TAG%: Starting setup 1...
echo !time! - %TAG%: Starting setup 1... >> "%LOGFILE%"

call :RunBat "90. Wait.bat"
call :RunBat "90. Focus.bat"
call :RunBat "01. Install.bat"
call :RunBat "02. Resolution.bat"
call :RunBat "90. Restart.bat" "00. Setup 2.bat"

goto :eof

:RunBat

set "BATFILE=%~1"
set "RUNONCEBAT=%~2"

if exist "%SETUPPATH%\%BATFILE%" (
    call "%SETUPPATH%\%BATFILE%" "%RUNONCEBAT%"
)
goto :eof

RunOnce:

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"AddRunOnce"="C:\\Users\\Public\\Desktop\\Setup\\00. Setup 1.bat"
 

Attachments

Last edited:
There's not enough details to understand if this a NTLite problem, or a basic scripting issue. You should try to add more logging:
Code:
echo !time! - %TAG%: Starting "%BATFILE%" >> "%LOGFILE%"

if exist "%SETUPPATH%\%BATFILE%" (
    call "%SETUPPATH%\%BATFILE%" "%RUNONCEBAT%" 2>&1 >> %LOGFILE%"
)

NTLite creates a RunOnceEx task for each (After logon) action. It doesn't matter what's inside your autounattend.xml, as long as the primary user logons to the desktop.
 
Hey garlin, the script is not running at all -- whether it's added in the NTLite Post-Setup > After-logon section or through the Registry section.

The problem is not the scripts -- they're not running. I thought maybe it could be my autounattend.xml, but I've since confirmed it's not.

It takes so long to install Win11, I have to get all the feedback I can here or I'll lose my mind reinstalling.

My iso is based on 24h2 with December's LCU.

My next troubleshooting step is to start with the base vanilla 26100.1 iso and add `echo Hello & pause` to the After-logon.
 
Last edited:
For sanity checking, add a simple (After logon) task to confirm Post-Setup is actually being called.
Code:
cmd /c echo Hello > C:\Users\Public\Documents\log.txt
 
Edit: The Start menu popping up on first logon isn't the the problem, is it? When it pops up, it seems like it REALLY wants attention.
No, it's not the real problem.

If you're ready to unfriend the Start Menu, run this script from Post-Setup (Before logon):
Code:
reg load HKU\Default C:\Users\Default\NTUSER.DAT
reg add "HKU\Default\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v StartShownOnUpgrade /t REG_DWORD /d 1 /f
reg unload HKU\Default
 
I have 100% confirmed this setting inside autounattend.xml causes the RunOnce and RunOnceEx to not trigger on Windows 11 24H2 - December 2024 LCU. Win10 22H2 - December LCU works fine with this setting in autounattend.xml.

Code:
<!-- This setting bricks NTLite's Post-Setup > After-logon (RunOnceEx) call to custom batch script -->
<UseConfigurationSet>false</UseConfigurationSet>

View attachment 13668
 
Last edited:
You're using a custom autounattend, which may or may not have been generated by Schn**gan's autounattend generator. I don't use his name because the last two times I mentioned a script created by that site, he hunts you down to claim it's 100% reliable and tested.

NTLite doesn't touch <UseConfigurationSet>, and the default setting is "false" any way.
 
I see! I'm not using his generator, but I did take parts of his output and integrated into mine.

Yeah, the setting is set to false, so why would it cause Windows to fail to trigger NTLite's RunOnceEx and my RunOnce? Seems like a bug somewhere.
 
I doubt the real problem is a NTLite bug. Just tried your autounattend.xml on a clean 23H2 Home image (happened to be the one I was testing for another forum question), and aside from removing the generic Pro key – my (After logon) task worked.

There's nothing in Unattended mode, or changing the LCU that would impact NTLite creating a RunOnceEx and having it run. RunOnceEx applies to the first logon user, so it doesn't matter what happens in Unattended. There are no Configuration Set folders, so that setting doesn't apply either.

Which leads me to believe you're omitting a key detail or two. This is your autounattend.xml, but cleaned up with proper whitespacing.
 

Attachments

Back
Top