2022-07-30 07:31:05 +00:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
2022-10-26 22:49:10 +00:00
|
|
|
Uninstall Winget-AutoUpdate
|
2022-07-30 07:31:05 +00:00
|
|
|
|
|
|
|
.DESCRIPTION
|
2023-03-31 15:56:07 +00:00
|
|
|
Uninstalls Winget-AutoUpdate (DEFAULT: clean old install)
|
2022-07-30 07:31:05 +00:00
|
|
|
https://github.com/Romanitho/Winget-AutoUpdate
|
|
|
|
|
|
|
|
.PARAMETER NoClean
|
|
|
|
Uninstall Winget-AutoUpdate (keep critical files)
|
|
|
|
|
|
|
|
.EXAMPLE
|
|
|
|
.\WAU-Uninstall.ps1 -NoClean
|
|
|
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
[CmdletBinding()]
|
|
|
|
param(
|
|
|
|
[Parameter(Mandatory = $False)] [Switch] $NoClean = $false
|
|
|
|
)
|
|
|
|
|
2022-06-04 23:18:17 +00:00
|
|
|
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"
|
|
|
|
|
2022-06-10 08:26:41 +00:00
|
|
|
try {
|
2022-06-04 23:18:17 +00:00
|
|
|
Write-host "Uninstalling WAU..." -ForegroundColor Yellow
|
2022-05-22 15:24:56 +00:00
|
|
|
#Get registry install location
|
|
|
|
$InstallLocation = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate\" -Name InstallLocation
|
2022-10-26 22:49:10 +00:00
|
|
|
|
2022-07-30 07:31:05 +00:00
|
|
|
#Check if installed location exists and delete
|
2022-06-10 08:26:41 +00:00
|
|
|
if (Test-Path ($InstallLocation)) {
|
2022-07-30 07:31:05 +00:00
|
|
|
|
|
|
|
if (!$NoClean) {
|
|
|
|
Remove-Item "$InstallLocation\*" -Force -Recurse -Exclude "*.log"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
#Keep critical files
|
2022-10-18 13:23:39 +00:00
|
|
|
Get-ChildItem -Path $InstallLocation -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force
|
2022-07-30 07:31:05 +00:00
|
|
|
}
|
2022-05-22 15:24:56 +00:00
|
|
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
2022-10-08 00:18:46 +00:00
|
|
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate-Notify" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
2022-10-26 22:49:10 +00:00
|
|
|
Get-ScheduledTask -TaskName "Winget-AutoUpdate-UserContext" -ErrorAction SilentlyContinue | Unregister-ScheduledTask -Confirm:$False
|
2022-05-22 15:24:56 +00:00
|
|
|
& reg delete "HKCR\AppUserModelId\Windows.SystemToast.Winget.Notification" /f | Out-Null
|
|
|
|
& reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
|
2022-10-31 12:21:04 +00:00
|
|
|
& reg delete "HKLM\Software\Classes\WAU" /f | Out-Null
|
2022-05-30 15:38:30 +00:00
|
|
|
if (Test-Path "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate") {
|
|
|
|
& reg delete "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate" /f | Out-Null
|
|
|
|
}
|
2022-05-22 15:24:56 +00:00
|
|
|
|
2022-10-11 14:03:57 +00:00
|
|
|
if ((Test-Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)")) {
|
|
|
|
Remove-Item -Path "${env:ProgramData}\Microsoft\Windows\Start Menu\Programs\Winget-AutoUpdate (WAU)" -Recurse -Force | Out-Null
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((Test-Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk")) {
|
|
|
|
Remove-Item -Path "${env:Public}\Desktop\WAU - Check for updated Apps.lnk" -Force | Out-Null
|
|
|
|
}
|
2022-10-26 22:49:10 +00:00
|
|
|
|
2022-05-22 15:24:56 +00:00
|
|
|
Write-host "Uninstallation succeeded!" -ForegroundColor Green
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Write-host "$InstallLocation not found! Uninstallation failed!" -ForegroundColor Red
|
|
|
|
}
|
|
|
|
}
|
2022-06-10 08:26:41 +00:00
|
|
|
catch {
|
2022-05-22 15:24:56 +00:00
|
|
|
Write-host "`nUninstallation failed! Run as admin ?" -ForegroundColor Red
|
2022-06-04 23:18:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Start-sleep 2
|