【问题标题】:Downloaded ChromeStandaloneSetup.exe with PowerShell is corrupt使用 PowerShell 下载的 ChromeStandaloneSetup.exe 已损坏
【发布时间】:2018-08-27 09:02:56
【问题描述】:

这是基于我之前的问题,我在接受的答案中使用脚本:https://stackoverflow.com/a/51933920/3737177

我设法通过 ps1 脚本下载了 exe,但它似乎已损坏。如果我将它与通过浏览器下载的文件进行比较,它们看起来是一样的。相同的文件版本,相同的 SHA,但使用脚本下载的会出错:

如果我尝试从脚本“.\ChromeStandaloneSetup.exe /install”执行它,还有更多信息,但这也无济于事:

任何想法,为什么这个 exe 在通过 PowerShell 下载时会损坏?或者更确切地说如何解决?

我用 PowerShell V4.0 和 5.1 试了一下,所以使用了 Invoke-WebRequest。

【问题讨论】:

  • 只是在黑暗中的一个镜头。如果将UserAgent 属性添加到像Invoke-WebRequest -Uri $uri -OutFile '<PATH>\ChromeStandaloneSetup64.exe' -UserAgent 'Mozilla/5.0 (Windows NT; Windows NT 6.1; nl-NL) AppleWebKit/534.6 (KHTML, like Gecko) Chrome/7.0.500.0 Safari/534.6' 这样的命令会发生什么?例如,您可以使用[Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer 获取更多用户代理字符串。
  • 您是否尝试禁用您的防病毒软件?某些 AV 会将此检测为“检测到网络木马”
  • @Theo 这两个选项我都试过了,但还是一样。

标签: powershell google-chrome


【解决方案1】:

我能够重现并遇到相同的错误。即使我从该解决方案中提供的 URL 手动下载安装程序。

当我使用 BITS(比 Invoke-WebRequest 快得多)从 https://enterprise.google.com/chrome/chrome-browser/ 下载 .msi 时,我可以静默安装 Google Chrome。

$uri = "https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi"

if (-not $PSScriptRoot) {
    $PSScriptRoot = Split-Path -Parent -Path $script:MyInvocation.MyCommand.Definition
}
$outFile = "$PSScriptRoot\googlechromestandaloneenterprise64.msi"

Start-BitsTransfer -Source $uri -Destination $outFile

Start-Process -FilePath $outFile -Args "/qn" -Wait

【讨论】:

  • 非常感谢,我会尽快尝试。虽然我目前正忙于其他事情。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-24
  • 1970-01-01
相关资源
最近更新 更多