Skip to content

Instantly share code, notes, and snippets.

@devenes
Created March 19, 2023 15:37
Show Gist options
  • Save devenes/47a4c36f9fb91bfd0e9ba74b2cdbfb6c to your computer and use it in GitHub Desktop.
Save devenes/47a4c36f9fb91bfd0e9ba74b2cdbfb6c to your computer and use it in GitHub Desktop.
Install Google Chrome on Windows Server
$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");Start-Process -FilePath "$LocalTempDir\$ChromeInstaller" -ArgumentList '/silent', '/install' -Wait;$Process2Monitor="chrome";Do{$ProcessesFound=Get-Process -Name $Process2Monitor -ErrorAction SilentlyContinue;if($ProcessesFound){Write-Host "Still running: $($ProcessesFound.Name -join ', ')";Start-Sleep -Seconds 2}else{Remove-Item -Path "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose}}until(!$ProcessesFound)$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");Start-Process -FilePath "$LocalTempDir\$ChromeInstaller" -ArgumentList '/silent', '/install' -Wait;$Process2Monitor="chrome";Do{$ProcessesFound=Get-Process -Name $Process2Monitor -ErrorAction SilentlyContinue;if($ProcessesFound){Write-Host "Still running: $($ProcessesFound.Name -join ', ')";Start-Sleep -Seconds 2}else{Remove-Item -Path "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose}}until(!$ProcessesFound)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment