Windows 11 SetupComplete.cmd is not working

carlosmp

New Member
Messages
18
Reaction score
1
It seems that I'm having issues with the execution of the SetupComplete.cmd. It seems to only run the lines up to the portion on installing Chocolatey. Is there a way to trouble shoot why it's not running? It used to work with the previous version of NTLite. I had to reinstall, and since then, it seems the second half of my script is not working. I have a second copy in a separate directory that i can run manually once logged in, and everythign works fine (except the winget, which is not a deal breaker)

Code:
echo =====> Starting Customizations
echo =====> Installing Control
msiexec /i "%ALLUSERSPROFILE%\RMM\Control.ClientSetup.msi" /qn
echo =====> Configuring Power Schemes
powercfg -restoredefaultschemes
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61
powercfg -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
powercfg /Change standby-timeout-ac 0
echo =====> Importing wireless profile
netsh wlan add profile filename="%ALLUSERSPROFILE%\RMM\bench.xml"
echo =====> Installing RMM Tools
"%ALLUSERSPROFILE%\RMM\Setup.exe" --console --allow-force-reboot
echo =====> Setting account Options
net accounts /maxpwage:unlimited
echo =====> Installing Chocolatey Modules
powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
echo =====> Installing base Apps
choco install -y notepadplusplus adobereader googlechrome 7zip.install microsoft-teams-new-bootstrapper
echo =====> Installing Office (Will take some time)
choco install -y --force office365business --params "'/configpath:C:\ProgramData\RMM\Office-Install-BP.xml'"
echo =====> Install Windows Store Tools
winget update --accept-source-agreements --accept-package-agreements
winget install --accept-source-agreements --accept-package-agreements "Windows Scan"
winget install --accept-source-agreements --accept-package-agreements "HEIF Image Extensions"
echo =====> Done - Computer should reboot

TIA,
Carlos.
 
I can see two possible problems with the script.

1. This line to update the PATH doesn't always work, because you're inside a batch script and not an interactive CMD shell.
Code:
echo =====> Installing Chocolatey Modules
powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Code:
echo =====> Installing Chocolatey Modules
powershell -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

2. winget (as part of DesktopInstaller) may not be enabled by the time you're calling it. Add this one PS command.
Code:
echo =====> Install Windows Store Tools
powershell Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
winget update --accept-source-agreements --accept-package-agreements
 
garlin - Thanks. I made those changes, but the setupcomplete.cmd didn't even run. I ran it manually, and saw a message about setting a 2 letter country as it went through the winget portion. Since those packages require a store account, going to remove those.

I remember there being an asynchronous option somewhere and don't see it in the latest version. I have the Post-Setup set to Unattended. Have tried different options, and haven't really seen a difference, since those commands are in the SetupComplete.cmd, which should execute silently...
 
The newer versions of DesktopAppInstaller (winget) available on GitHub doesn't require any MS Accounts to install free packages.

If you're using a licensed copy of NTLite, Downloads Updater will automatically download and include them in your image. For the free users, you can use asheroto's winget-install.ps1 script:
Code:
powershell -C "irm https://github.com/asheroto/winget-install/releases/latest/download/winget-install.ps1 ^| iex"

To debug any CMD script, you can always run "command line 2&1 >> C:\log.txt"
 
garlin - Yes, it's a licensed version. So if I add the Microsfot.DesktopAppInstaller via that choosing the Enqueue, that would take care of the WinGet update? Then I could use the commands I had to install those packages? (adding the --source msstore)

Thanks
 
Including the last 3 packages on the Updates list gets you the GitHub version of DesktopAppInstaller.

But you still need the PS command for -RegisterByFamilyName to "kick start" the normal UWP licensing process so that winget works immediately.
 
Back
Top