major logging overhaul, plus other fixes
This commit is contained in:
+52
-54
@@ -1,56 +1,54 @@
|
||||
## Uninstall SketchUp 2016
|
||||
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2016\SketchUp.exe" )
|
||||
## Version of SketchUp to install
|
||||
$InstallVersion = "2020"
|
||||
|
||||
## Make sure we have an administrative token
|
||||
If ( IsAdmin )
|
||||
{
|
||||
Write-Output "Uninstalling SketchUp 2016..."
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList '/X{D87EE6DC-32BA-4219-AC75-0A6FD54ED058} /qn /norestart' -Wait }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Uninstall SketchUp 2017
|
||||
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2017\SketchUp.exe" )
|
||||
{
|
||||
Write-Output "Uninstalling SketchUp 2017..."
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList '/X{E59BD84C-169B-4F3F-AC5D-85127CF67051} /qn /norestart' -Wait }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Uninstall SketchUp 2019
|
||||
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2019\SketchUp.exe" )
|
||||
{
|
||||
Write-Output "Uninstalling SketchUp 2019..."
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList '/X{06964675-EB01-6D18-6704-429DE73A8319} /qn /norestart' -Wait }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Uninstall SketchUp 2020
|
||||
If ( Test-Path "${Env:ProgramFiles}\SketchUp\SketchUp 2020\SketchUp.exe" )
|
||||
{
|
||||
Write-Output "Uninstalling SketchUp 2020..."
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList '/X{5778f9a3-781e-16f1-a6bf-08fd59dfa77b} /qn /norestart' -Wait }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Define URL for downloading the installer
|
||||
$URL = 'https://www.sketchup.com/sketchup/2020/SketchUpPro-exe'
|
||||
$FILE = '{0}\{1}.exe' -f $Env:TEMP,(Split-Path $URL -Leaf)
|
||||
|
||||
## Remove previous package
|
||||
If ( Test-Path $FILE ) { Remove-Item -Path $FILE -Force | Out-Null}
|
||||
|
||||
## Download installer
|
||||
Write-Output "Downloading: ${URL}"
|
||||
Try { (New-Object System.Net.WebClient).DownloadFile($URL, $FILE) }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
|
||||
## Install package
|
||||
Write-Output "Installing: ${FILE}"
|
||||
Try { Start-Process -FilePath $FILE -ArgumentList "/silent" -Wait }
|
||||
Catch { $_.Exception.Message }
|
||||
|
||||
## Delete installer package
|
||||
If ( Test-Path $FILE )
|
||||
{
|
||||
Write-Output "Deleting ${FILE}"
|
||||
Try { Remove-Item -Path $FILE -Force }
|
||||
Catch { Write-Output $_.Exception.Message }
|
||||
## 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 }
|
||||
}
|
||||
|
||||
## Set the local file name to download to
|
||||
$FILE = '{0}{1}.exe' -f (GetTempPath),(Split-Path $URL -Leaf)
|
||||
|
||||
## Download installer
|
||||
$FILE = Download-File -URL $URL -File $FILE
|
||||
|
||||
## Install package
|
||||
Install-Program -Path $FILE -Arguments "/silent" -Delete
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user