Powershell script to re-register AppX works fine when run as admin but won't work as startup script RRS feed

  • Question

  • Hello,

    I had many computers on the network that had some of Win 10 AppX not working due to some Windows updates.

    I have found this Powershell command to cure all the problems by re-registering all AppXs on the PC.

    Get-AppXPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}

    This script works fine when I run it on the computer as admin.

    As I don't want to visit each and every computer on our domain, I have set this to run as a Powershell startup script via group policy.

    But it seems to fail, on each and every AppX when it runs at startup script.

    I've enabled viewing of startup script and can see the error to be for each AppX:

    add-appxpackage deployment failed with hresult 0x80073cf9 install failed.

    But when the same script runs after login normally it works fine.

    Many thanks

    Tuesday, February 11, 2020 10:54 AM

All replies

  • Please do not post pictures of errors or code in this forum.

    AppX has to be run in an interactive session or under an admin account.

    Repairs are one time and should not be scripted, scheduled or applied as a startup/login script.


    • Edited by jrv Tuesday, February 11, 2020 11:25 AM
    Tuesday, February 11, 2020 11:25 AM
  • Hi,

    The script has a code where it makes a file on C:\ and if it exist then it won't run again, so runs only once.

    Are you saying that this line of script can't ever work from a startup script?

    If So, how do I avoid visiting each and every computer in the domain?


    Tuesday, February 11, 2020 11:40 AM
  • I would suggest posting in the AppX forum to find the tools and procedures you need to do this for a network.

    One way that can work and doesn't require altering the network is to use Invoke-Command oro use a workflow.

    You can also use DSC for many things but I am not sure if a DSC package is available.

    Here is the DSC AppX package installer module:


    Tuesday, February 11, 2020 1:29 PM
  • Thanks jrv,

    I can see that with Invoke-Command I can run this script on a remote computer.

    This will probably only work if the computer is switched on.

    A startup script is better because any computer/ laptop that was left in the cupboard will get it once it is switched on.

    Is it not possible to run it as a startup script because startup script are using the local system account?

    Or is it because the computer is not fully finished loading Windows?

    Thinking also of an option to run it as a schedule task that runs only once.

    Wednesday, February 12, 2020 11:21 AM