4

Is it possible to download the latest version of Google Chrome using Powershell. I'm an IT Admin looking at putting a script together for our field techs. Since upgrading our client machines to Windows 10 21H2 LTSC, the current script no longer works which used to download the .msi and install it. Seems Google has changed the way it now downloads and installs.

2
  • 10
    What research have you done and what have you tried? What was your old script? What part(s) of it have stopped working? Oct 23, 2023 at 4:19
  • winget is an option, chocolatery is an option, and even Invoke-WebRequest -uri $URL -OutFile $SaveAs if you know the address. For invoke-webrequest to work, ensure that your script has SSL 1.2 enabled. $TLS12Protocol = [System.Net.SecurityProtocolType] 'Ssl3 , Tls12' [System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol
    – LPChip
    Oct 23, 2023 at 6:50

3 Answers 3

13

With winget:

winget install -e --id Google.Chrome

It is a Windows package manager from Microsoft and part of the App Installer https://apps.microsoft.com/detail/9NBLGGH4NNS1

Install via

Install-Module -Name Microsoft.WinGet.Client

Read more at https://learn.microsoft.com/en-us/windows/package-manager/winget/

3
  • prefer not to install "extra" tools to get the apps downloaded. Google should just make the msi downloadable.
    – uberdude
    Oct 24, 2023 at 3:17
  • 6
    Do you consider the web browser to download the msi an extra tool? In Linux, a package manager is essential: apt on Debian and Ubuntu, pacman on Arch, Zypper on openSUSE and yum on RHEL. Windows puts a lot of effort into winget to get on par. I encourage you to give it a try.
    – cachius
    Oct 24, 2023 at 9:12
  • no cachius, the browser is not an "extra" tool - powershell should be able to download and install msi all in one go.
    – uberdude
    Oct 31, 2023 at 2:50
4

Without you telling us what is actually going wrong, giving you the right answer is going to be hard.

Yes, I can name a few different ways on how to install Chrome, but I suspect the problem you're having is not so much the url changing, but the fact that SSL/TLS1.2 is forced and older versions are disabled. If you don't enable this in your script, all the various download options will simply not connect, and thus not work.

Put the following in your script before you initiate the download and if its indeed this, then it should work again.

$TLS12Protocol = [System.Net.SecurityProtocolType] 'Ssl3 , Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $TLS12Protocol
2
  • problem having is not ssl but rather app compatibility. for example when downloading from dl.google.com/edgedl/chrome/install/… and installing i get an error that the app is not compatible for my current version of windows
    – uberdude
    Oct 24, 2023 at 3:20
  • 2
    That is crucial information. Please edit your question and include that information to receive answers that help you. Include the target OS version as well.
    – LPChip
    Oct 24, 2023 at 6:32
0

According to this website :

$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor =  "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)

Tested and working on Windows (10, 11) and Windows Server as well.

4
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Oct 24, 2023 at 9:53
  • 1
    And do you expect to update this script every time a new version of Chrome comes out? The download URL in your script has Chrome version in it.
    – Aleks G
    Oct 24, 2023 at 15:40
  • I'm still looking for ways to detect the latest version number.
    – Tesla Mick
    Oct 25, 2023 at 9:45
  • correct - thats the hard part. finding an installer link that always contains the latest version
    – uberdude
    Oct 31, 2023 at 2:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .