Skip to content

Commit

Permalink
Merge pull request #2248 from microsoft/dpaul-HcADGroupCount
Browse files Browse the repository at this point in the history
Check for 0 entries in list before trying to loop thru it
  • Loading branch information
dpaulson45 authored Dec 6, 2024
2 parents 9deeb1e + 70b28d7 commit ebfe4e8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ebfe4e8

Please sign in to comment.