MicrosoftDocs / windows-powershell-docs

This repo is used to contribute to Windows 10, Windows Server 2016, and MDOP PowerShell module documentation.
Creative Commons Attribution 4.0 International
441 stars 594 forks source link

Use the system user to run the command Add-AppxPackage #2391

Closed maysaribeiro closed 3 years ago

maysaribeiro commented 3 years ago

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.0neutral ~ 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?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

o0nj commented 3 years ago

@maysaribeiro

The issues section of this repository is intended for documentation problems.

Please consider checking any relevant resources and asking the community about your problem via the following link.

PowerShell Community

Also feel free to reply if there is anything else that could be done to improve the document itself.

Thanks.