From 8c7cfebc112e5799e33d58b192be30deb64464cd Mon Sep 17 00:00:00 2001 From: dyoder Date: Wed, 23 Jun 2021 19:42:22 -0400 Subject: [PATCH] update to install 2021 version and take advantage of the Download-File function --- Install-SketchUp.ps1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Install-SketchUp.ps1 b/Install-SketchUp.ps1 index e296768..d1569bc 100644 --- a/Install-SketchUp.ps1 +++ b/Install-SketchUp.ps1 @@ -1,5 +1,5 @@ ## Version of SketchUp to install -$InstallVersion = "2020" +$InstallVersion = "2021" ## Make sure we have an administrative token If ( IsAdmin ) @@ -41,12 +41,17 @@ If ( IsAdmin ) Try { Start-Process "msiexec.exe" -ArgumentList '/X{5778f9a3-781e-16f1-a6bf-08fd59dfa77b} /qn /norestart' -Wait } Catch { LogErr $_.Exception.Message } } - - ## Set the local file name to download to - $FILE = '{0}{1}.exe' -f (GetTempPath),(Split-Path $URL -Leaf) + + ## Uninstall SketchUp 2021 + If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2021\SketchUp.exe" ) + { + LogMsg "Uninstalling SketchUp 2021" + Try { Start-Process "msiexec.exe" -ArgumentList '/X{e31a06f0-fc24-f59f-5b2c-941521be9626} /qn /norestart' -Wait } + Catch { LogErr $_.Exception.Message } + } ## Download installer - $FILE = Download-File -URL $URL -File $FILE + $FILE = Download-File -URL $URL ## Install package Install-Program -Path $FILE -Arguments "/silent" -Delete