From 97547a209dd298bb164fb1eaf0811c3913fb90e8 Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Sun, 5 Jun 2022 01:18:17 +0200 Subject: [PATCH] Keep log on uninstall --- Winget-AutoUpdate/WAU-Uninstall.ps1 | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/Winget-AutoUpdate/WAU-Uninstall.ps1 b/Winget-AutoUpdate/WAU-Uninstall.ps1 index b3c8400..8ae6c03 100644 --- a/Winget-AutoUpdate/WAU-Uninstall.ps1 +++ b/Winget-AutoUpdate/WAU-Uninstall.ps1 @@ -1,10 +1,24 @@ +Write-Host "`n" +Write-Host "`t 888 888 d8888 888 888" -ForegroundColor Magenta +Write-Host "`t 888 o 888 d88888 888 888" -ForegroundColor Magenta +Write-Host "`t 888 d8b 888 d88P888 888 888" -ForegroundColor Magenta +Write-Host "`t 888 d888b 888 d88P 888 888 888" -ForegroundColor Magenta +Write-Host "`t 888d88888b888 d88P 888 888 888" -ForegroundColor Magenta +Write-Host "`t 88888P Y88888 d88P 888 888 888" -ForegroundColor Cyan +Write-Host "`t 8888P Y8888 d88P 888 888 888" -ForegroundColor Magenta +Write-Host "`t 888P Y888 d88P 888 Y8888888P`n" -ForegroundColor Magenta +Write-Host "`t Winget-AutoUpdate`n" -ForegroundColor Cyan +Write-Host "`t https://github.com/Romanitho/Winget-AutoUpdate`n" -ForegroundColor Magenta +Write-Host "`t________________________________________________________`n`n" + try{ + Write-host "Uninstalling WAU..." -ForegroundColor Yellow #Get registry install location $InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation #Check if installed location exists and delete if (Test-Path ($InstallLocation)){ - Remove-Item $InstallLocation -Force -Recurse + Remove-Item "$InstallLocation\*" -Force -Recurse -Exclude "*.log" Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False & reg delete "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /f | Out-Null @@ -14,7 +28,6 @@ try{ } Write-host "Uninstallation succeeded!" -ForegroundColor Green - Start-sleep 1 } else { Write-host "$InstallLocation not found! Uninstallation failed!" -ForegroundColor Red @@ -22,5 +35,6 @@ try{ } catch{ Write-host "`nUninstallation failed! Run as admin ?" -ForegroundColor Red - Start-sleep 1 -} \ No newline at end of file +} + +Start-sleep 2