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.

3
  • 11
    What research have you done and what have you tried? What was your old script? What part(s) of it have stopped working? Commented 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 Commented Oct 23, 2023 at 6:50
  • Official Docs: Install Chrome offline. More context on stackoverflow.com/questions/65008246/… Commented Mar 7 at 11:10

3 Answers 3

15

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

If you find that the module is not already installed (Windows releases since Windows 10 version 1709 include it automatically), it can be installed via

Install-Module -Name Microsoft.WinGet.Client 

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

4
  • prefer not to install "extra" tools to get the apps downloaded. Google should just make the msi downloadable. Commented 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. Commented 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. Commented Oct 31, 2023 at 2:50
  • 1
    Works quite well. Just make sure the App installer is updated via Microsoft Store and Powershell is running in admin mode Commented Jul 14, 2024 at 9:45
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 Commented 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. Commented Oct 24, 2023 at 6:32
2

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.

5
  • 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. Commented 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. Commented Oct 24, 2023 at 15:40
  • I'm still looking for ways to detect the latest version number. Commented Oct 25, 2023 at 9:45
  • correct - thats the hard part. finding an installer link that always contains the latest version Commented Oct 31, 2023 at 2:55
  • bravo. Worked like a charm! Commented Jul 13, 2024 at 14:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.