From 9a7453b753522247d6a59b46023e8e7100b61c2b Mon Sep 17 00:00:00 2001 From: Andi Schabus Date: Tue, 22 Aug 2023 15:57:31 +0200 Subject: [PATCH] feat: Confirm-PolicyDefinitionIsValid.ps1 returns different exit codes for success, warnings and error --- Scripts/Confirm-PolicyDefinitionIsValid.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Scripts/Confirm-PolicyDefinitionIsValid.ps1 b/Scripts/Confirm-PolicyDefinitionIsValid.ps1 index 4c5b5875..8213ce44 100644 --- a/Scripts/Confirm-PolicyDefinitionIsValid.ps1 +++ b/Scripts/Confirm-PolicyDefinitionIsValid.ps1 @@ -55,14 +55,17 @@ if ($errorMessages.Count -gt 0) { $messagesString += (($warningMessages.ToArray()) -join "`n ") } Write-Host $messagesString -ForegroundColor Red + exit 2 # Errors found } else { if ($warningMessages.Count -gt 0) { $messagesString = "'$($file.FullName)' has auto-fix warnings:`n " $messagesString += (($warningMessages.ToArray()) -join "`n ") Write-Host $messagesString -ForegroundColor Yellow + exit 3 # Warnings found } else { Write-Host "'$($file.FullName)' is valid." -ForegroundColor Blue + exit 0 # No errors or warnings foundS } -} +} \ No newline at end of file