微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

当 MSI 失败并显示“无法连接到服务器错误:0x80070005”时如何升级 Azure CLI

如何解决当 MSI 失败并显示“无法连接到服务器错误:0x80070005”时如何升级 Azure CLI

我需要在我没有管理但可以远程运行脚本的机器上更新 Azure CLI,因此我基本上可以访问 CLI。使用 recommended PowerShell script to install Azure CLI 时,修改为不是 hang inside Invoke-WebRequest 而是 logs the installation details,我看到安装失败并显示日志消息“无法连接到服务器。错误:0x80070005”。

我查找了错误代码 0x80070005 means "Access Denied by DCOM"。我还读到了 "server" is actually the Windows Installer service commanded by the msiexec client

是否可以在没有机器管理员协助的情况下升级 Azure CLI?如何朝这个方向进一步调查?

到目前为止我的脚本:

Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile AzureCLI.msi -UseBasicParsing
start-process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet /L*v! AzureCLI.log'
Get-Content AzureCLI.log
rm AzureCLI.msi,AzureCLI.log

日志是:

=== Verbose logging started: 3/12/2021  1:49:26  Build type: SHIP UNICODE 5.00.10011.00  Calling process: C:\windows\system32\msiexec.exe ===
MSI (c) (D4:F0) [01:49:26:301]: Resetting cached policy values
MSI (c) (D4:F0) [01:49:26:301]: Machine policy value 'Debug' is 0
MSI (c) (D4:F0) [01:49:26:301]: ******* RunEngine:
           ******* Product: AzureCLI.msi
           ******* Action: 
           ******* CommandLine: **********
MSI (c) (D4:F0) [01:49:26:317]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (D4:F0) [01:49:26:317]: Grabbed execution mutex.
MSI (c) (D4:F0) [01:49:26:332]: Failed to connect to server. Error: 0x80070005

MSI (c) (D4:F0) [01:49:26:332]: Note: 1: 2774 2: 0x80070005 
1: 2774 2: 0x80070005 
MSI (c) (D4:F0) [01:49:26:332]: Failed to connect to server.
MSI (c) (D4:F0) [01:49:26:348]: MainEngineThread is returning 1601
=== Verbose logging stopped: 3/12/2021  1:49:26 ===

过去,我可以使用上述推荐的 PowerShell oneliner 从头开始​​在多台此类机器上安装 Azure CLI。这台机器是 Azure DevOps Server 代理,我可以编辑和运行使用它的 Azure Pipelines。我知道我最好问问管理员,但他们在企业的一个单独部门,众所周知,他们无法访问、不可靠,而且他们让每个人都跳过了愚蠢的无意义的圈套。我们的 Scrum 团队发现,当我们自己处理技术上能做到的一切并且只要求他们做只有他们能做的事情时,通常效率最高。

考虑使用 az upgrade,但它在幕后calls powershell.exe -NoProfile "Start-Process msiexec.exe -Wait -ArgumentList '/i https://aka.ms/installazurecliwindows'",这不是无人值守的安装(缺少 /quiet)。当当前版本已安装时,它会保存 MSI 下载并处理其他操作系统上的其他包管理器,但我现在不需要任何这些。

还考虑过使用工具安装程序任务,但我不知道 Azure CLI 的任何内容,当然在我们的 DevOps 服务器中也不知道。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。