【问题标题】:Install appx through Powershell Plugin via Jenkins通过 Jenkins 通过 Powershell 插件安装 appx
【发布时间】:2016-03-11 19:45:26
【问题描述】:

我在尝试使用 Jenkins 中的 Powershell 插件使用 Powershell -ExecutionPolicy Unrestricted add-appxpackage <path to appx> 安装 appx 时遇到问题,并记录了以下错误:

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].

据我了解,这个问题主要是因为 Windows 上的 Jenkins 服务安装为NT Authority\System。 (如果我使用 psexec.exe 打开以 Authority\System 身份运行的命令提示符,我会遇到同样的问题。)然后我尝试添加 net localgroup "Administrators" NT Authority\System /add 希望该组可能会被添加为管理员并让我安装 appx,所以我可以运行测试,但没有成功。现在我被卡住了,我不确定是否真的有办法通过 Jenkins 安装 appx,或者是否有办法通过 Jenkins 以管理员身份调用 Powershell 脚本。我已经通过了几个 SO 链接,但它们似乎都没有解决我面临的问题。任何指针将不胜感激。

【问题讨论】:

    标签: windows powershell jenkins appx


    【解决方案1】:

    请勿尝试将 System 添加到 Administrators 组,因为某种原因,它是一个受限帐户,并且不需要管理权限。

    改为将 Jenkins 服务更改为以对您尝试执行的操作具有正确权限的用户身份运行。这可能意味着您需要专门为 Jenkins 服务创建一个帐户。

    有几种方法可以更改服务帐户,this answer 给出了以下解决方案:

    sc.exe config "Service Name" obj= "DOMAIN\User" password= "password"
    

    【讨论】:

    • 将主 Jenkins 服务更改为特定用户返回 Windows could not start Jenkins service on a Local Computer。所以,我想它必须改回 System.但是,主要问题是 Jenkins 在 Windows 从站上生成的命令提示符/Powershell 窗口需要以管理员身份运行,否则软件包安装将无法通过。 Windows Slave 也可以在远程机器上运行,从机和主机都通过wiki.jenkins-ci.org/display/JENKINS/Swarm+Plugin 进行通信
    • 等一下,它可能刚刚在我的系统上得到修复,其中主从都在同一台机器上,上面的解决方案。将研究如何在从站位于远程的地方做类似的事情。
    • 刚刚解决了远程机器上的问题,让 jenkins swarm 服务以管理员身份运行。谢谢。
    猜你喜欢
    • 2019-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-16
    • 2013-05-15
    • 2014-03-12
    相关资源
    最近更新 更多