Install appx through Powershell Plugin via Jenkins

4

I am stuck in a problem trying to install appx with Powershell -ExecutionPolicy Unrestricted add-appxpackage <path to appx> using the Powershell plugin in Jenkins and the below errors are logged:

add-appxpackage : Deployment failed with HRESULT: 0x80073CF9, Install failed. Please contact your software vendor. (Exception from HRESULT: 0x80073CF9) Deployment Add operation rejected on package <path to appx> install request because the Local System account is not allowed to perform this operation. NOTE: For additional information, look for [ActivityId].

As I understand, this problem is mainly because Jenkins service on Windows gets installed as NT Authority\System. (If I use psexec.exe to open a command prompt that runs as Authority\System, I run into the same issue.) I then tried adding net localgroup "Administrators" NT Authority\System /add hoping the group might get added as Administrator and would let me install the appx, so I can run the tests, but with no success. Now I am stuck and I am not sure if there is really a way to install an appx via Jenkins or not OR if there is a way to invoke the Powershell script as an administrator via Jenkins. I have been through couple of SO links already, but none of them seems to fix the issue I am facing. Any pointers would be appreciated.

windows
powershell
jenkins
appx
asked on Stack Overflow Dec 7, 2015 by learn_develop • edited Dec 7, 2015 by Micha Wiedenmann

1 Answer

1

DO NOT try to add System to the Administrators group, it's a limited account for a reason and does not require administrative privileges.

Instead change the Jenkins service to run as a user that has the right permissions for what you're trying to do. That might mean you need to create an account specifically for the Jenkins service.

There are a few ways to change the service account, this answer gives the following as a solution:

sc.exe config "Service Name" obj= "DOMAIN\User" password= "password"
answered on Stack Overflow Dec 7, 2015 by arco444 • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0