winutil/functions/public/Invoke-WPFRunAdobeCCCleanerTool.ps1
Ken Hoo 841f87564a Improve handling of Adobe's CC Cleaner tool
Implement a try-catch-finally struct to do a better handling of Adobe's Creative Cloud Cleaner tool downloading and running of such program.

This will allow to see any errors that occurs if the URL changes or the tool fails to run.

I also have moved the cleaning up process to the finally part of the structure, as it makes the most sense.

This tries to fix the issue #1563.
2024-02-11 17:01:04 +01:00

33 lines
1.3 KiB
PowerShell

function Invoke-WPFRunAdobeCCCleanerTool {
<#
.SYNOPSIS
It removes or fixes problem files and resolves permission issues in registry keys.
.DESCRIPTION
The Creative Cloud Cleaner tool is a utility for experienced users to clean up corrupted installations.
#>
[string]$url="https://swupmf.adobe.com/webfeed/CleanerTool/win/AdobeCreativeCloudCleanerTool.exe"
Write-Host "The Adobe Creative Cloud Cleaner tool is hosted at"
Write-Host "$url"
try {
# Don't show the progress because it will slow down the download speed
$ProgressPreference='SilentlyContinue'
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -UseBasicParsing -ErrorAction SilentlyContinue -Verbose
# Revert back the ProgressPreference variable to the default value since we got the file desired
$ProgressPreference='Continue'
Start-Process -FilePath "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Wait -ErrorAction SilentlyContinue -Verbose
} catch {
Write-Error $_.Exception.Message
} finally {
if (Test-Path -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe") {
Write-Host "Cleaning up..."
Remove-Item -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Verbose
}
}
}