From ba75392800d94559bf476bda48cf8a672ab43fe9 Mon Sep 17 00:00:00 2001 From: Fabian Seitz Date: Mon, 16 Oct 2023 09:15:03 +0200 Subject: [PATCH] Handle small errors better --- Winget-AutoUpdate-Install.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index afb8356..620db58 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -488,7 +488,7 @@ function Install-WingetAutoUpdate { Start-WingetAutoUpdate } catch { - Write-host "WAU Installation failed! Run me with admin rights" -ForegroundColor Red + Write-host "WAU Installation failed! Error $_ - Try running me with admin rights" -ForegroundColor Red Start-sleep 1 return $False } @@ -634,6 +634,8 @@ else { Uninstall-WingetAutoUpdate } -Remove-Item "$WingetUpdatePath\Version.txt" -Force +if (Test-Path "$WingetUpdatePath\Version.txt") { + Remove-Item "$WingetUpdatePath\Version.txt" -Force +} Write-host "`nEnd of process." -ForegroundColor Cyan Start-Sleep 3