Skip to content

Instantly share code, notes, and snippets.

@jbaker10
Created December 10, 2018 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbaker10/5a1d7f5f90c9338a798fb48475836433 to your computer and use it in GitHub Desktop.
Save jbaker10/5a1d7f5f90c9338a798fb48475836433 to your computer and use it in GitHub Desktop.
########
## Edit the variables below as necessary
$url = "http://zoom.us/client/latest/ZoomInstallerFull.msi"
$output = "C:\Temp\Zoom.msi"
########
try {
## Kill the process if running
"Trying to quit the application if running"
Stop-Process -Name Zoom* -Force
}
catch {
"The application was not running. Proceeding with installation"
}
"Checking if temp dir exists, creating if not"
$path = "C:\Temp"
if(!(Test-Path -Path $path)){
"Creating temp directory"
New-Item -ItemType directory -Path $path
}
try {
## Download the file and output it to the defined location
"Downloading application"
Invoke-WebRequest -Uri $url -OutFile $output
## Install the newly downloaded file
"Installing application"
Invoke-Command -ScriptBlock { & cmd /c "msiexec.exe /i $output" /qn }
## Remove the cached installer
"Removing cached installer"
Remove-Item $output
}
catch {
"Unable to successfully download and install the application. Exiting"
exit 1
}
"The application was successfully installed"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment