Created
December 10, 2018 19:46
-
-
Save jbaker10/5a1d7f5f90c9338a798fb48475836433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## | |
## 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