From e2fa0ca8f714728fb55f05f5c7ebeb87aca056cf Mon Sep 17 00:00:00 2001 From: David Paulson Date: Thu, 8 Feb 2024 14:20:46 -0600 Subject: [PATCH] Only add key if not already in the list --- .../HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 | 6 +++++- Diagnostics/HealthChecker/Analyzer/Get-IPFilterSetting.ps1 | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 b/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 index b735855d17..1fa42b511f 100644 --- a/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 +++ b/Diagnostics/HealthChecker/Analyzer/Get-IISAuthenticationType.ps1 @@ -106,7 +106,11 @@ function Get-IISAuthenticationType { # for this configuration type, clear flag doesn't appear to be used at all. foreach ($appKey in $appHostConfigLocations) { Write-Verbose "Working on appKey: $appKey" - $getIisAuthenticationType.Add($appKey, [string]::Empty) + + if (-not ($getIisAuthenticationType.ContainsKey($appKey))) { + $getIisAuthenticationType.Add($appKey, [string]::Empty) + } + $currentKey = $appKey $authentication = @() $continue = $true diff --git a/Diagnostics/HealthChecker/Analyzer/Get-IPFilterSetting.ps1 b/Diagnostics/HealthChecker/Analyzer/Get-IPFilterSetting.ps1 index ce7564eb62..ddf440ac37 100644 --- a/Diagnostics/HealthChecker/Analyzer/Get-IPFilterSetting.ps1 +++ b/Diagnostics/HealthChecker/Analyzer/Get-IPFilterSetting.ps1 @@ -16,7 +16,11 @@ function Get-IPFilterSetting { process { foreach ($appKey in $locationPaths) { Write-Verbose "Working on appKey: $appKey" - $ipFilterSettings.Add($appKey, (New-Object System.Collections.Generic.List[object])) + + if (-not ($ipFilterSettings.ContainsKey($appKey))) { + $ipFilterSettings.Add($appKey, (New-Object System.Collections.Generic.List[object])) + } + $currentKey = $appKey $continue = $true