Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
install chrome from powershell
(new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', 'c:/temp/chrome.exe');. c:/temp/chrome.exe /silent /install;rm c:/temp -rec
@oit63
Copy link

oit63 commented Dec 11, 2017

nice script ,help me on server 1709!

@tylerschloesser
Copy link

tylerschloesser commented Dec 29, 2017

fabulous. was pulling my hair out trying to use ie11 on my aws EC2 instance XD

@periyatv-aws
Copy link

periyatv-aws commented Jan 27, 2018

neat thanks..

@shaikhakhtar
Copy link

shaikhakhtar commented Feb 6, 2018

Thanks @yaxzone for your script. It worked very well...!!

@ahmadmarafa
Copy link

ahmadmarafa commented Feb 28, 2018

Thaaaank youuu

@simonherbert
Copy link

simonherbert commented Apr 28, 2018

Thanks @nicolaigj !
It works on Windows Server 2008 R2, 2012, 2012 R2, and 2016.
Way better than trying to use IE to download Chrome.

@ChristianOtte
Copy link

ChristianOtte commented Jun 1, 2018

This is awesome! Helps the deployment day on 30+ servers
@nicolaigj - you really made the script nice and readable in true powershell fasion

@rcaljouw
Copy link

rcaljouw commented Jun 28, 2018

Nice!

Thanks both @yaxzone and @nicolaigj

@foxx
Copy link

foxx commented Jul 23, 2018

Why are you not using https? Why are you not using latest?

https://dl.google.com/chrome/install/latest/chrome_installer.exe

@Larswa
Copy link

Larswa commented Aug 10, 2018

@XuTenghao Can you start up Chrome on the Windows server 1709? I use as a buildserver and wanted to run Selenium tests, but the chrome.exe fails with a pretty generic "ERROR:main_dll_loader_win.cc(134)] Failed to load Chrome DLL" Are you getting that, or can you log on to the server and do a chrome.exe --headless ?

@Connor14
Copy link

Connor14 commented Aug 16, 2018

@Larswa I had the same problem.

@redramos
Copy link

redramos commented Oct 5, 2018

You can use this:

$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $Path$Installer; Start-Process -FilePath $Path$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path$Installer

@Penta-admin
Copy link

Penta-admin commented Oct 10, 2018

after installing ,how we can bring up chrome in server 1709

@Hugo22O
Copy link

Hugo22O commented Dec 26, 2018

after installing ,how we can bring up chrome in server 1709

It should be on your desktop.

@eesheesh
Copy link

eesheesh commented Feb 8, 2019

Here's a version of @redramos's command that can work from the Run dialog (considering its length limits):
PowerShell -Command "& {$P = $env:TEMP + '\chrome_installer.exe'; Invoke-WebRequest 'https://dl.google.com/chrome/install/latest/chrome_installer.exe' -OutFile $P; Start-Process -FilePath $P -Args '/silent /install' -Verb RunAs -Wait; Remove-Item $P}"

@o-l-a-v
Copy link

o-l-a-v commented Oct 9, 2019

Neat commands y'all. But it installs 32 bit Chrome on 64 bit Windows. Anyone found a always latest version URL for Chrome 64 bit?

@imthisguymike
Copy link

imthisguymike commented Nov 10, 2019

Neat commands y'all. But it installs 32 bit Chrome on 64 bit Windows. Anyone found a always latest version URL for Chrome 64 bit?

@o-l-a-v Using this code, it downloads the online installer, and the 64-bit version is downloaded and installed:
$uri = "https://dl.google.com/chrome/install/latest/chrome_installer.exe" $path = "$PSScriptRoot\ChromeSetup.exe" Invoke-WebRequest -Uri $uri -OutFile $path Start-Process $path /install -NoNewWindow -Wait Remove-Item .\ChromeSetup.exe

@o-l-a-v
Copy link

o-l-a-v commented Nov 11, 2019

@STiG-1
Yeah, I've found that url too. It installs x86 which will get upgraded to x64 later on of the OS is actually x64.

@goprojojo
Copy link

goprojojo commented Nov 21, 2019

I don't have access to internet on my windows server. How can I use this script then?

@jrudley
Copy link

jrudley commented Dec 2, 2019

I don't have access to internet on my windows server. How can I use this script then?

You need to download the offline installer for Chrome. Store it on some internal file share and copy down during install or add it into the image, etc

@lachlann562
Copy link

lachlann562 commented Apr 24, 2020

For something a little more sophisticated, here is a powershell function you can run. it also uses the latest version, not a specific version. i also used -PassThru to get the explicit process i started.

function Install-Chrome
{
    $LocalTempDir = $env:TEMP; 
    $ChromeInstaller = "ChromeInstaller.exe"; 
    $url='http://dl.google.com/chrome/install/latest/chrome_installer.exe'; 
    $output="$LocalTempDir\$ChromeInstaller"

    try {
        (new-object    System.Net.WebClient).DownloadFile($url, $output); 
        $p = Start-Process $output -ArgumentList "/silent","/install" -PassThru -Verb runas; 

        while (!$p.HasExited) { Start-Sleep -Seconds 1 }

        Write-Output ([PSCustomObject]@{Success=$p.ExitCode -eq 0;Process=$p})
    } catch {
        Write-Output ([PSCustomObject]@{Success=$false;Process=$p;ErrorMessage=$_.Exception.Message;ErrorRecord=$_})
    } finally {
        Remove-Item "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose
    }

}

Install-Chrome

@prc1234
Copy link

prc1234 commented May 26, 2020

thank you so much. This solution works like a charm. Is there a way by which i can extract the chrome version from "http://dl.google.com/chrome/install/latest/chrome_installer.exe"

@jtatum
Copy link

jtatum commented Dec 8, 2020

If you get an error like Invoke-WebRequest : The underlying connection was closed, your system may be configured with strong TLS ciphers by default. Change them in the current powershell environment by running [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

@kyungjaepark
Copy link

kyungjaepark commented Nov 4, 2021

Thanks to @eesheesh , I could install chrome in Run Dialog. Here's slightly improved version which reduces download time by removing progress bar. ( https://stackoverflow.com/a/43477248 )

PowerShell -Command "& {$P=$env:TEMP+'\chrome_installer.exe';$ProgressPreference='SilentlyContinue';IWR 'https://dl.google.com/chrome/install/latest/chrome_installer.exe' -OutFile $P;SAPS -FilePath $P -Args '/silent /install' -Verb RunAs -Wait;DEL $P}"

@siddhijain
Copy link

siddhijain commented Feb 9, 2022

"http://dl.google.com/chrome/install/latest/chrome_installer.exe" This is not downloading the latest version of Chrome. Does anyone know the reason?

@giuscri
Copy link

giuscri commented Feb 21, 2022

❤️ @nicolaigj

@eesheesh
Copy link

eesheesh commented Mar 10, 2022

Thanks @kyungjaepark! I've put this in a dedicated website, to make it easy for folks to quickly install Chrome/Firefox on a new machine, without having to type in the command: https://insta.llc (works with http://insta.llc without redirects as well, for folks installing versions of Windows that complain about HTTPS).

@shleeable
Copy link

shleeable commented Jul 27, 2022

$uri = "https://dl.google.com/chrome/install/latest/chrome_installer.exe";
$path = "$PSScriptRoot\ChromeSetup.exe";
Invoke-WebRequest -Uri $uri -OutFile $path;
Start-Process $path /install -NoNewWindow -Wait; 
Remove-Item $path;

@ahashem87a
Copy link

ahashem87a commented Aug 4, 2022

Thanks @kyungjaepark! I've put this in a dedicated website, to make it easy for folks to quickly install Chrome/Firefox on a new machine, without having to type in the command: https://insta.llc (works with http://insta.llc without redirects as well, for folks installing versions of Windows that complain about HTTPS).

This is amazing work, thank you so much! If I could only find something similar for Adobe Reader my life would be complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment