Among the first things we usually want to do right after we've installed a brand-new Windows Server is to also install Google Chrome. Doing that won't always be easy, though, because Internet Explorer Enhanced Security - which is activated by default in Windows Server - won't allow to download the required setup package.
In order to fix this you have two options: either disable the Enhanced Security entirely by following these steps or execute the following Powershell Script, which will install Google Chrome in a matter of seconds:
1 |
$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) |
Although this isn't an one-liner technically, it can be used as one: just copy it, paste it into a Powershell prompt and you'll be good to go. Needless to say, you'll need to have an internet connection available, otherwise it won't work.
Many thanks to this Gist for the idea and to this other Gist for the actual implementation.
Even easier is to just install FireFox first (which doesn’t pose any problems), and then from FireFox install Chrome. I just did this in Windows Server 2016, and it was easy without having to change any settings or run any obscure command line scripts.
Thank you Erik, that was the simplest solution:-)
Obrigado pela dica! Dessa forma foi bem simples instalar o Chrome no servidor.
Thanks for the tip! So it was pretty simple to install Chrome on the server.
what about if i want to install other software like VLC,Adobe,skype and so on….
is there any easyiest way ? means with exe how to install on VM by using Powershell script
Great script!
Just in case you need use proxy and proxy port.
$LocalTempDir = $env:TEMP; $ChromeInstaller = “ChromeInstaller.exe”;
$WebClient = New-Object System.Net.WebClient;
$WebProxy = New-Object System.Net.WebProxy(“http://my_proxy:1234”);
$WebClient.Proxy = $WebProxy;
$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)