Skip to content

Instantly share code, notes, and snippets.

@tanfwc
Last active June 3, 2023 12:35
Show Gist options
  • Save tanfwc/f6d5881442eb3bfdd1639f1471d2f2ad to your computer and use it in GitHub Desktop.
Save tanfwc/f6d5881442eb3bfdd1639f1471d2f2ad to your computer and use it in GitHub Desktop.
Azure Virtual Desktop Chrome Installation Script
<#Author : Tan Fang Wai
# Usage : Install and setup Chrome
#>
######################
# WVD Variables #
######################
$LocalTempDir = "c:\temp\chrome\";
$ChromeInstaller = "ChromeInstaller.exe";
####################################
# Test/Create Temp Directory #
####################################
if((Test-Path c:\temp) -eq $false) {
Write-Host "Install Chrome : Creating temp directory"
New-Item -Path c:\temp -ItemType Directory
}
else {
Write-Host "Install Chrome : C:\temp already exists"
}
if((Test-Path $LocalTempDir) -eq $false) {
Write-Host "Install Chrome : Creating directory: $LocalTempDir"
New-Item -Path $LocalTempDir -ItemType Directory
}
else {
Write-Host "Install Chrome : $LocalTempDir already exists"
}
####################################
# Download Chrome #
####################################
Write-Host "Install Chrome : Downloading Chrome"
$uri = "https://dl.google.com/chrome/install/latest/chrome_installer.exe"
$path = "$LocalTempDir\ChromeStandaloneSetup64.exe"
Invoke-WebRequest -Uri $uri -OutFile $path
####################################
# Download Chrome #
####################################
Write-Host "Install Chrome : Starting to install Chrome"
$chrome_deploy_status = Start-Process `
-FilePath "$LocalTempDir\ChromeStandaloneSetup64.exe" `
-ArgumentList "/silent /install" `
-Wait `
-Passthru
#Cleanup
if ((Test-Path -Path $LocalTempDir -ErrorAction SilentlyContinue)) {
Remove-Item -Path $LocalTempDir -Force -Recurse -ErrorAction Continue
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment