App install over SetupComplete.cmd file not working.

Discussion in 'Windows 11' started by Outbreaker, Nov 10, 2022.

  1. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
    Hi,
    I'm trying to install an App with the SetupComplete.cmd file but it won't work. Dose someone know a solution for this?
    Code:
    DISM /Online /Add-ProvisionedAppxPackage /PackagePath:"%SystemRoot%\Setup\Files\MyApp.Msixbundle" /SkipLicense
    PowerShell -command "Add-AppXProvisionedPackage -Online -PackagePath '%SystemRoot%\Setup\Files\MyApp.Msixbundle' -SkipLicense"
     
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    For online installation, Add-AppxPackage should follow Add-AppxProvisionedPackage
    Code:
    PowerShell -command "Add-AppXProvisionedPackage -Online -PackagePath '%SystemRoot%\Setup\Files\MyApp.Msixbundle' -SkipLicense; Add-AppxPackage -Path '%SystemRoot%\Setup\Files\MyApp.Msixbundle'"
     
  3. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
  4. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    Add-AppxPackage install it for current user, which in SetupComplete.cmd phase is still System account

    it's best to add the app to install.wim
    or try to install it during specialize phase
     
  5. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
    It's really illogical that you can install Apps for all users with an Administrator Account but not with the System Account. But that's Microsoft i guess.
     
  6. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
    Dose someone know why some new added Apps won't start when they have no access to the internet at the first launch?
     
  7. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,316
    7,022
    210
    Could it be they first need to acquire a license (even if only a free one)?
     
  8. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
  9. Carlos Detweiller

    Carlos Detweiller Emperor of Ice-Cream

    Dec 21, 2012
    6,316
    7,022
    210
    I'm not an expert with UFW framework, but as far as I know the apps require licenses, and some can be acquired and pre-integrated somehow.

    Would have to ask one of the app experts here, maybe @abbodi1406?
     
  10. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
  11. migascalp

    migascalp MDL Senior Member

    Sep 18, 2009
    299
    465
    10
    I don't use dism method but I suggest another approach
    I am currently working on installing ScreenSketch, Photos and ZuneMusic on LTSC 2019/2021 from SetupComplete.cmd
    For this I am based on the command provided by abbodi1406
    Using -LicensePath parameter solved license problem which requires an internet connection for first launch of application
    Code:
    PowerShell -command "Add-AppXProvisionedPackage -Online -PackagePath '%SystemRoot%\Setup\Files\MyApp.AppxBundle' -LicensePath '%SystemRoot%\Setup\Files\MyApp.xml'; Add-AppxPackage -Path '%SystemRoot%\Setup\Files\MyApp.AppxBundle'"
    On LTSC 2021 this command work from SetupComplete.cmd
    On LTSC 2019 this command work only from firstlogon.cmd

    So for LTSC 2019 I use the following command in SetupComplete.cmd to launch firstlogon.cmd at the first logon
    Code:
    Reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v "firstlogon" /t REG_SZ /d "\"%SystemRoot%\Setup\Files\firstlogon.cmd\"" /f
    Hoping to help
     
  12. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
    #14 Outbreaker, Nov 13, 2022
    Last edited: Nov 14, 2022
    (OP)
    @abbodi1406
    All in all that means, there is no way to get this to work. Because we can only get an Offline License with an Microsoft Store for Business account?

    @migascalp
    Are you using an Online or Offline License?
     
  13. migascalp

    migascalp MDL Senior Member

    Sep 18, 2009
    299
    465
    10
  14. Outbreaker

    Outbreaker MDL Senior Member

    Jan 20, 2018
    278
    59
    10
    @migascalp @abbodi1406
    Can you even use an Offline License from an other App with a different App? I'm still don't know where i can get/create an Offline License without an Microsoft Store for Business account. :tumbleweed:
     
  15. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    16,141
    84,318
    340
    Of course no

    OEMs pay to "create" that offline license
    you can only live up with online license per machine