diff --git a/PowerShell/BloodHound.ps1 b/PowerShell/BloodHound.ps1 index 865af7e4b..7cfca30ab 100644 --- a/PowerShell/BloodHound.ps1 +++ b/PowerShell/BloodHound.ps1 @@ -5420,17 +5420,23 @@ function Get-NetGroupMember { $GroupSearcher.filter = "(&(objectCategory=group)(objectSID=$SID)$Filter)" } + $Members = @() try { $Result = $GroupSearcher.FindOne() } catch { - $Members = @() + Write-Verbose "Error retrieving group searcher results: $_" } $GroupFoundName = '' - if ($Result) { - $Members = $Result.properties.item("member") + if ($Result -and $Result.properties) { + try { + $Members = $Result.properties.item("member") + } + catch { + Write-Verbose "Error retrieving members property." + } if($Members.count -eq 0) {