Downloaded ChromeStandaloneSetup.exe with PowerShell is corrupt

偶尔善良 提交于 2021-01-29 11:10:37

问题


This is based on my previous question where I use the script in the accepted answer: https://stackoverflow.com/a/51933920/3737177

I manage to download the exe via a ps1 script, but it seems it is corrupt. If I compare it to a file downloaded through the browser they look the same. Same file version, same SHA, but the one downloaded with a script gets an error:

If I try to execute it from the script ".\ChromeStandaloneSetup.exe /install" there is some more information, but this doesn't help either:

Any ideas, why this exe is corrupt when downloaded through PowerShell? Or rather how to fix it?

I tried it with PowerShell V4.0 and 5.1, so the Invoke-WebRequest is used.


回答1:


I was able to reproduce and experience the same error. Even if I manually download the installer from the URL provided in that solution.

When I download the .msi from https://enterprise.google.com/chrome/chrome-browser/ using BITS (which is much faster than Invoke-WebRequest), I am able to silently install 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


来源:https://stackoverflow.com/questions/52035868/downloaded-chromestandalonesetup-exe-with-powershell-is-corrupt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!