0

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:

Unknown Installer Error

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

Errorcode 0x80040c01

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.

Thomas
  • 6,325
  • 4
  • 30
  • 65
  • just a shot in the dark.. What happens if you add the `UserAgent` property to the command like `Invoke-WebRequest -Uri $uri -OutFile '\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'`? You can get more useragent strings by using `[Microsoft.PowerShell.Commands.PSUserAgent]::InternetExplorer` for instance. – Theo Aug 27 '18 at 14:03
  • Have you tried to disable your Anti-virus ? some AV will detect this as "A Network Trojan was detected" – Bonneau21 Aug 27 '18 at 14:17
  • @Theo I tried both options, but it's still the same. – Thomas Aug 27 '18 at 14:25

1 Answers1

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
John Seerden
  • 166
  • 4
  • Thanks a lot for this, I'll try it out as soon as I can. Though I'm currently busy with other stuff. – Thomas Aug 30 '18 at 11:29