Skip to content

Commit

Permalink
Merge pull request #1843 from microsoft/dpaul-WmiCriticalHandler
Browse files Browse the repository at this point in the history
Handle Write-Error in Get-WmiObjectCriticalHandler to avoid reports
  • Loading branch information
dpaulson45 authored Oct 4, 2023
2 parents 811f48c + 80f78e0 commit 438ba8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Diagnostics/HealthChecker/Features/Get-HealthCheckerData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions Diagnostics/HealthChecker/HealthChecker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand All @@ -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 {
Expand Down

0 comments on commit 438ba8a

Please sign in to comment.