update uninstall method

This commit is contained in:
2023-01-13 08:34:55 -05:00
parent 35dd913537
commit ea77a6f7ee
+11 -53
View File
@@ -1,67 +1,25 @@
## Make sure we have an administrative token
# $InstallVersion must be set by the calling script or specified here
# Make sure we have an administrative token
If ( IsAdmin )
{
## Define URL for downloading the installer
# Define URL for downloading the installer
$URL = "https://www.sketchup.com/sketchup/${InstallVersion}/SketchUpPro-exe"
## Make sure the URL is valid before we do anything
# Make sure the URL is valid before we do anything
If ( IsURLValid $URL )
{
## Uninstall SketchUp 2016
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2016\SketchUp.exe" )
{
LogMsg "Uninstalling SketchUp 2016"
Try { Start-Process "msiexec.exe" -ArgumentList '/X{D87EE6DC-32BA-4219-AC75-0A6FD54ED058} /qn /norestart' -Wait }
Catch { LogErr $_.Exception.Message }
}
## Uninstall SketchUp 2017
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2017\SketchUp.exe" )
{
LogMsg "Uninstalling SketchUp 2017"
Try { Start-Process "msiexec.exe" -ArgumentList '/X{E59BD84C-169B-4F3F-AC5D-85127CF67051} /qn /norestart' -Wait }
Catch { LogErr $_.Exception.Message }
}
## Uninstall SketchUp 2019
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2019\SketchUp.exe" )
{
LogMsg "Uninstalling SketchUp 2019"
Try { Start-Process "msiexec.exe" -ArgumentList '/X{06964675-EB01-6D18-6704-429DE73A8319} /qn /norestart' -Wait }
Catch { LogErr $_.Exception.Message }
}
## Uninstall SketchUp 2020
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2020\SketchUp.exe" )
{
LogMsg "Uninstalling SketchUp 2020"
Try { Start-Process "msiexec.exe" -ArgumentList '/X{5778f9a3-781e-16f1-a6bf-08fd59dfa77b} /qn /norestart' -Wait }
Catch { LogErr $_.Exception.Message }
}
# Uninstall all versions of SketchUp
$APP_NAME = "SketchUp"
Run-Script -LivePSScript Uninstall-MSI
## 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 }
}
## Uninstall SketchUp 2022
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2022\SketchUp.exe" )
{
LogMsg "Uninstalling SketchUp 2022"
Try { Start-Process "msiexec.exe" -ArgumentList '/X{898ed298-4bc7-f67e-2e5b-6202a980787a} /qn /norestart' -Wait }
Catch { LogErr $_.Exception.Message }
}
## Set the local file name to download to
# Set the local file name to download to
$FILE = '{0}{1}.exe' -f (GetTempPath),(Split-Path $URL -Leaf)
## Download installer
# Download installer
$FILE = Download-File -URL $URL -File $FILE
## Install package
# Install package
Install-Program -Path $FILE -Arguments "/silent" -Delete
}
}