Forum Discussion

maysaribeiro's avatar
maysaribeiro
Copper Contributor
Apr 12, 2021

run Add-AppPackage using user system

I have a service that performs some processes and can even be run installation commands. This service is performed by the local system user (SID S-1-5-18).

 

So I sent the command below for the service to run, which it runs using powerShell as the local system

 

 

 

 

Add-AppxPackage -Path "C:\Dir1\Dir2\Dir3\Windows\App.UWP_2.0.27.0_x64.msixbundle" -DependencyPath "C:\Dir1\Dir2\Dir3\Windows\Dependencies\x64\Microsoft.NET.Native.Framework.2.2.appx", "C:\Dir1\Dir2\Dir3\Windows\Dependencies\x64\Microsoft.NET.Native.Runtime.2.2.appx", "C:\Dir1\Dir2\Dir3\Windows\Dependencies\x64\Microsoft.UI.Xaml.2.4.appx", "C:\Dir1\Dir2\Dir3\Windows\Dependencies\x64\Microsoft.VCLibs.x64.14.00.appx"

 

 

 

 

However when trying to run, I get the error:

 

The AppX Deployment operation for CodeWith7-CodeWith4-CodeWith4-CodeWith4-CodeWith12_2.0.27.0_neutral_ ~ 3kncj78a7wnxj failed with error 0x80073CF9. The specific error text for this failure is: Add deployment operation rejected in the CodeWith7-CodeWith4-CodeWith4-CodeWith4-CodeWith12_2.0.27.0_neutral ~ _3kncj78a7wnxj package: App.UWP_2.0.27.0_x64.msixbundle installation request because the account of the Local System is not allowed to perform this operation.

 

When I change the service manually so that it runs using a local administrator user, the command runs without any error. I have a business need to run this command as a local system. Does anyone know how I can do this?


Or, does anyone know how to explain to me WHAT is done in the process that requires an ADM user?

 

  • I have already verified that the machine has developer mode enabled.
  • Before executing the Add-AppPackage command I perform the import of the certificate, so the certificate is installed: "Import-Certificate -FilePath "{0}"-CertStoreLocation Cert:\LocalMachine\Root", Path.Combine ( directoryInstallation, item)
  • I tried to change the command from Add-AppPackage to Add-AppxPackage, but it also didn't work
  • I tried to change the command to run Add-AppDevPackage.ps1, but it also didn't work
  • David_Alvarez's avatar
    David_Alvarez
    Copper Contributor

    maysaribeiro I'm pretty sure it's because Add-AppxPackage installs the application into the profile of the account running the command, and Local System does not have a regular user profile.

     

    My organization needed to apply updates for Windows Store Appx applications, and we do not have a Windows Store. Instead, I used MECM to stage the files on my org's computers, then ran PSExec with an administrator account to start a PS script that installs the updates. 

     

    I've been meaning to look into using Add-AppxProvisionedPackage instead, but haven't had the time.

     

    If you have any additional information, I'd be glad to hear it.

Resources