From ee3d84506e8c306556877d42de3b1492a0118230 Mon Sep 17 00:00:00 2001 From: dyoder Date: Thu, 27 May 2021 17:40:13 -0400 Subject: [PATCH] tidy up and check for previous install --- Install-4KVideoDownloader.ps1 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Install-4KVideoDownloader.ps1 b/Install-4KVideoDownloader.ps1 index b0d4bf1..ac9867b 100644 --- a/Install-4KVideoDownloader.ps1 +++ b/Install-4KVideoDownloader.ps1 @@ -1,16 +1,18 @@ - - -## Specify the URL to download 4K Video Downloader from +## Specify the URL to download the app from $URL = 'https://dl.4kdownload.com/app/4kvideodownloader_4.16.0_x64.msi' -## Install Adobe Connect -If ( IsURLValid $URL ) { - LogMsg "Downloading installer from ${URL}" +## Make sure the app isn't already installed +If (! (Test-Path "${Env:ProgramFiles}\4KDownload\4kvideodownloader\4kvideodownloader.exe") ) { + + ## Download the installer $INSTALLER = Download-File -URL $URL + + ## Install the app Try { Start-Process "msiexec.exe" -ArgumentList "/i ${INSTALLER} /qn /norestart" -Wait } Catch { LogErr $_.Exception.Message } + + ## Delete the installer LogMsg "Deleting downloaded installer from ""${INSTALLER}""" Try { Remove-Item -Path $INSTALLER -Force -ErrorAction SilentlyContinue } Catch { LogErr $_.Exception.Message } -} -Else { LogMsg "URL is not valid: ${URL}" } \ No newline at end of file +} \ No newline at end of file