我在尝试使用 Jenkins 中的 Powershell 插件安装 appx 时遇到问题,Powershell -ExecutionPolicy Unrestricted add-appxpackage <path to 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 链接,但它们似乎都没有解决我面临的问题。任何指针将不胜感激。