What changed? Post-Setup After Logon Script not run

exelanz

Member
Hi,
Last time I ran my build was roughly two months ago. No problems.

I updated NTLite and now my Post Setup After Logon Script is not run. I tried the OEM checkbox on Unattended page, but nothing.

I can see the script in the $OEM subfolder.

Did I miss something?

Many thanks in advance.

Arno
 
Hi Arno,

the latest version should have all the issues ironed out.
If not, please send me the preset with explanation what to look for, which post-setup command/installer did not run.

Thanks.
 
Mod note: Redacted user password and license key.

nuhi garlin Well, I did not succeed. Tried out many different settings, but script is not running. Here some details:
  • Windows 11 23H2
  • Preset: attached
  • AutoUnattended.xml attached
  • Application Installation script embedded below
  • Tried it on 2 different physical machines and 2 different virtual machines
Basically I am trying to run the Application powershell script After Logon (user):
  • Application Installation powershell script
  • This script uses winget to install apps
  • For this reason I have added/enabled appx/winget update in updates section and I don´t use my old script for updating winget anymore
  • After install I can see winget has been updated to version 1.7xxx
  • If I run the script manually it fails - but this is expected (by default powershell scripts are not allowed)
  • I do not see any kind of error message, window pop-up etc
This used to work a month ago. Now it does not.

Hope you have some insights, because I ran out of options.

Many thanks in advance.


Code:
# Install some apps

# Install IOBit Uninstaller
Write-Output "Installing IOBit Uninstaller..."
winget install IObit.Uninstaller --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Powershell 7
Write-Output "Installing Powershell 7..."
winget install Microsoft.PowerShell --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Chrome
Write-Output "Installing Chrome..."
winget install Google.Chrome --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Chocolately
Write-Output "Installing Chocolately..."
winget install Chocolatey.Chocolatey --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

Start-Sleep -Seconds 5

# Add Cholately to current path
#$envath += "C:\ProgramData\chocolatey\bin"

Start-Sleep -Seconds 5

# Install 1Password
Write-Output "Installing 1Password..."
winget install AgileBits.1Password --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Double Commander
Write-Output "Installing Double Commander..."
winget install alexx2000.DoubleCommander --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install NTLite
Write-Output "Installing NTLite..."
winget install Nlitesoft.NTLite --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Steam
Write-Output "Installing Steam..."
winget install Valve.Steam --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Rufus
Write-Output "Installing Rufus..."
winget install Rufus.Rufus --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Ubisoft Connect
Write-Output "Installing Ubisoft Connect..."
winget install Ubisoft.Connect --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Epic Games Launcher
Write-Output "Installing Epic Games Launcher..."
winget install EpicGames.EpicGamesLauncher --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install Evernote
Write-Output "Installing Evernote..."
winget install evernote.evernote --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install GameSaveManager
Write-Output "Installing GameSaveManager..."
winget install InsaneMatt.GameSaveManager  --disable-interactivity --silent --accept-source-agreements --accept-package-agreements

# Install RivaTuner
Write-Output "InstallingRivaTuner..."
winget install Guru3D.RTSS --disable-interactivity --silent --accept-source-agreements --accept-package-agreements


Start-Sleep -Seconds 5

# Install AMD Ryzen Master
#Write-Output "Switching to Chocolately..."
#Write-Output "Installing AMD Ryzen Master..."
#choco install amd-ryzen-master -y

Start-Sleep -Seconds 5
 

Attachments

  • Debug.xml
    7.3 KB
  • autounattend.xml
    4.6 KB
Last edited by a moderator:
Anybody? Over the past days I continued with testing, but my script is not run. Even not a powershell or terminal window popping up. In the past I have had these and sometimes they provided an error message so helped me to debug. Now nothing in the logs, nothing on screen. What is going on?
 
Have you tried the latest version of NTLite? I recently did and my Post-Install process finally completed, albeit with a (potentially unrelated) few issues to iron out.
 
Yes, I tried it yesterday with latest version, but still no luck. This evening I will try another script, that just opens notepad, to see if I have something executed. Will be commenting here for sure on the outcome.
 
Yes, I tried it yesterday with latest version, but still no luck. This evening I will try another script, that just opens notepad, to see if I have something executed. Will be commenting here for sure on the outcome.

Do you call Powershell scripts with "Powershell.exe"? Maybe you can check if the EXE is in your path?
 
Thanks all for your feedbacks. Appreciated.

Ok, I created another Powershell script that simply starts notepad. To my surprise this worked. So there is a problem with my script. It is the one that I posted (embedded) above, the script installs some apps via winget. This always worked. Feedback appreciated.
 
I would replace this script with "winget --info > C:\log.txt" for a quick sanity check.
 
Ok, I tried what you suggested garlin. The file is empty. So this means in my opinion that calling "winget" during post setup / after logon is causing the problem.

I will run some more tests to see what is happening and try to find a solution.
 
So I assumed that:

Updates: ‘Windows Package Manager (App Installer, WinGet)’ added to the update list
Updates: ‘Microsoft.UI.Xaml v2.8.6’ added to the update list


from release 2024.3.9812 would make my "upgrade winget" script obsolete. If I go this route, winget is upgraded to 1.7x BUT my app install script does not run after logon.

If I stick to my old way, run winget upgrade - after logon, then my app install script is being ran. Winget version shows 1.7x.

I do nu understand what is the difference. garlin does this make sense?
 
If NTLite doesn't bother to download & provision a valid License1.xml in the image, then winget (DesktopAppInstaller) isn't activated for another 5-10 minutes. Which is why your previous script works.
Code:
 Directory of C:\Program Files\NTLite\Cache\Updates\11.23H2.x64

04/04/2024  10:22 AM       258,189,720 Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
04/04/2024  10:15 AM         5,121,145 Microsoft.UI.Xaml.2.8.x64.appx
04/04/2024  10:15 AM         6,764,349 Microsoft.VCLibs.x64.14.00.Desktop.appx

Quick fix for your current script. Ask nuhi what he forgot to do...
Code:
# Wait until ClipSvc provides Windows a per-machine app license
Start-Sleep 5*60  # seconds

# Install some apps
 
Wow.

Amazing piece of insight garlin. This explains everything.

I was banging my head on the table...

Thanks a lot. Again.

I´ll leave it with nuhi - maybe something can be changed.
 
After searching for winget-cli bug reports on GitHub, I found MS had updated their winget instructions with a specific fix.

Use the winget tool to install and manage applications
The winget tool will not be available until you have logged into Windows as a user for the first time, triggering Microsoft Store to register Windows Package Manager as part of an asynchronous process. If you have recently logged in as a user for the first time and find that winget is not yet available, you can open PowerShell and enter the following command to request this winget registration: Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.

I followed the official NTLite path, and added newer DesktopAppInstaller and its two dependencies on a clean image.

Here's my test script for Post-Setup (User):
Code:
winget --info > C:\log1.txt
powershell Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
winget --info > C:\log2.txt

log1.txt was empty.
log2.txt reported the version info.


To summarize, to avoid using an external winget install script:

1. Add the updated DesktopAppInstaller package and its two dependencies.
2. Run the PS command before calling winget.

Downloading and adding the License1.xml would still remove any need for the extra Add-AppxPackage command.
 
Back
Top