From 95ae38f9627bdb091fc53b0321fd51389ed2e421 Mon Sep 17 00:00:00 2001 From: David Paulson Date: Wed, 4 Oct 2023 10:06:26 -0500 Subject: [PATCH 1/2] Add Write-Warning to debug log --- Diagnostics/HealthChecker/HealthChecker.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Diagnostics/HealthChecker/HealthChecker.ps1 b/Diagnostics/HealthChecker/HealthChecker.ps1 index 3bc5e6cabc..aa46bf459c 100644 --- a/Diagnostics/HealthChecker/HealthChecker.ps1 +++ b/Diagnostics/HealthChecker/HealthChecker.ps1 @@ -172,6 +172,7 @@ begin { . $PSScriptRoot\..\..\Shared\LoggerFunctions.ps1 . $PSScriptRoot\..\..\Shared\OutputOverrides\Write-Host.ps1 . $PSScriptRoot\..\..\Shared\OutputOverrides\Write-Verbose.ps1 + . $PSScriptRoot\..\..\Shared\OutputOverrides\Write-Warning.ps1 . $PSScriptRoot\..\..\Shared\ScriptUpdateFunctions\Test-ScriptVersion.ps1 $BuildVersion = "" @@ -192,6 +193,7 @@ begin { -ErrorAction SilentlyContinue SetProperForegroundColor SetWriteVerboseAction ${Function:Write-DebugLog} + SetWriteWarningAction ${Function:Write-DebugLog} } process { $Server | ForEach-Object { $Script:ServerNameList.Add($_.ToUpper()) } } end { From 80f78e0fa9638646f12e4a4a878552cd868cd589 Mon Sep 17 00:00:00 2001 From: David Paulson Date: Wed, 4 Oct 2023 10:27:12 -0500 Subject: [PATCH 2/2] Properly handle a failure to collect against a server --- Diagnostics/HealthChecker/Features/Get-HealthCheckerData.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Diagnostics/HealthChecker/Features/Get-HealthCheckerData.ps1 b/Diagnostics/HealthChecker/Features/Get-HealthCheckerData.ps1 index cd88896cd6..0209fcfb30 100644 --- a/Diagnostics/HealthChecker/Features/Get-HealthCheckerData.ps1 +++ b/Diagnostics/HealthChecker/Features/Get-HealthCheckerData.ps1 @@ -113,6 +113,8 @@ function Get-HealthCheckerData { } catch { Write-Red "Failed to Health Checker against $serverName" $failedServerList.Add($serverName) + # Try to handle the issue so we don't get a false positive report. + Invoke-CatchActions continue }