Files
management-scripts/Install-SketchUp.ps1
T

68 lines
2.7 KiB
PowerShell
Raw Normal View History

2020-10-22 14:01:35 -04:00
## Make sure we have an administrative token
If ( IsAdmin )
2020-08-30 23:05:07 -04:00
{
2020-10-22 14:01:35 -04:00
## 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
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 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 }
}
2020-10-22 14:01:35 -04:00
2022-09-21 20:30:40 -04:00
## 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
$FILE = '{0}{1}.exe' -f (GetTempPath),(Split-Path $URL -Leaf)
2020-10-22 14:01:35 -04:00
## Download installer
$FILE = Download-File -URL $URL -File $FILE
2020-10-22 14:01:35 -04:00
## Install package
Install-Program -Path $FILE -Arguments "/silent" -Delete
}
2020-08-30 23:05:07 -04:00
}