From 4de1ac39ef88ac11734ebbb8e56258a80aae77a7 Mon Sep 17 00:00:00 2001 From: ChrisTitusTech Date: Thu, 22 Feb 2024 01:32:49 +0000 Subject: [PATCH] Compile Winutil --- winutil.ps1 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/winutil.ps1 b/winutil.ps1 index 30d5b78d..4fbea76b 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -3890,19 +3890,23 @@ function Invoke-WPFRunAdobeCCCleanerTool { Write-Host "The Adobe Creative Cloud Cleaner tool is hosted at" Write-Host "$url" - # Don't show the progress because it will slow down the download speed - $ProgressPreference='SilentlyContinue' + 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 + 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' + # 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 - - if (Test-Path -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe") { - Write-Host "Cleaning up..." - Remove-Item -Path "$env:TEMP\AdobeCreativeCloudCleanerTool.exe" -Verbose + 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 + } } } function Invoke-WPFRunspace {