使用PowerShell下载的ChromeStandaloneSetup.exe损坏 [英] Downloaded ChromeStandaloneSetup.exe with PowerShell is corrupt

查看:73
本文介绍了使用PowerShell下载的ChromeStandaloneSetup.exe损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是基于我先前的问题,我在接受的答案中使用脚本:

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

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

我在PowerShell V4.0和5.1上进行了尝试,因此使用了Invoke-WebRequest.

解决方案

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

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

  $ uri ="https://dl.google.com/chrome/install/googlechromestandaloneenterprise64.msi"如果(-不是$ PSScriptRoot){$ PSScriptRoot =拆分路径-父级-路径$ script:MyInvocation.MyCommand.Definition}$ outFile ="$ PSScriptRoot \ googlechromestandaloneenterprise64.msi"Start-BitsTransfer-源$ uri-目标$ outFile开始过程-FilePath $ outFile -Args"/qn"-等待 

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.

解决方案

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

这篇关于使用PowerShell下载的ChromeStandaloneSetup.exe损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆