From 78724ae344a670bbfe62c98cc488cd5fb666e61b Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Thu, 22 Dec 2022 03:39:48 +0100 Subject: [PATCH] If winget can't be found - exit with error + text --- Winget-AutoUpdate/Winget-Upgrade.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index e92c77c..678082d 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -89,7 +89,7 @@ if (Test-Network) { } else { Write-Log "Critical: List doesn't exist, exiting..." "Red" - New-Item "$WorkingDir\logs\list_error.txt" -Force + New-Item "$WorkingDir\logs\list_error.txt" -Value "List doesn't exist!" -Force Exit 1 } } @@ -216,6 +216,11 @@ if (Test-Network) { Write-Log "User context execution not installed" } } + else { + Write-Log "Critical: An error occured, exiting..." "red" + New-Item "$WorkingDir\logs\winget_error.txt" -Value "Winget not installed or detected!" -Force + Exit 1 + } } #End