From 70b28d75ebbec183e2d0178b4052c879df8c82a1 Mon Sep 17 00:00:00 2001 From: David Paulson Date: Fri, 6 Dec 2024 12:57:56 -0600 Subject: [PATCH] Check for 0 entries in list before trying to loop thru it --- .../Analyzer/Invoke-AnalyzerExchangeInformation.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerExchangeInformation.ps1 b/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerExchangeInformation.ps1 index 340825a65..a0e81c386 100644 --- a/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerExchangeInformation.ps1 +++ b/Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerExchangeInformation.ps1 @@ -317,7 +317,8 @@ function Invoke-AnalyzerExchangeInformation { if ($exchangeInformation.ComputerMembership.ADGroupMembership -eq "NoAdModule") { $displayMissingGroups.Add("Missing Active Directory Module. Run 'Install-WindowsFeature RSat-AD-PowerShell'") - } elseif ($null -ne $exchangeInformation.ComputerMembership.ADGroupMembership) { + } elseif ($null -ne $exchangeInformation.ComputerMembership.ADGroupMembership -and + $exchangeInformation.ComputerMembership.ADGroupMembership.Count -gt 0) { foreach ($adGroup in $adGroupList) { if (($null -eq ($exchangeInformation.ComputerMembership.ADGroupMembership.SID | Where-Object { $_.ToString() -eq $adGroup.SID }))) { $displayMissingGroups.Add("$($adGroup.WellKnownName) - AD Group Membership")