diff --git a/PowerShell/BloodHound.ps1 b/PowerShell/BloodHound.ps1 index 7cfca30ab..342f5984a 100644 --- a/PowerShell/BloodHound.ps1 +++ b/PowerShell/BloodHound.ps1 @@ -7793,18 +7793,23 @@ function Get-NetLocalGroup { # try to extract out the machine SID by using the -500 account as a reference $MachineSid = $LocalUsers | Where-Object {$_.SID -like '*-500'} - $Parts = $MachineSid.SID.Split('-') - $MachineSid = $Parts[0..($Parts.Length -2)] -join '-' + try { + $Parts = $MachineSid.SID.Split('-') + $MachineSid = $Parts[0..($Parts.Length -2)] -join '-' - $LocalUsers | ForEach-Object { - if($_.SID -match $MachineSid) { - $_ | Add-Member Noteproperty 'IsDomain' $False - } - else { - $_ | Add-Member Noteproperty 'IsDomain' $True + $LocalUsers | ForEach-Object { + if($_.SID -match $MachineSid) { + $_ | Add-Member Noteproperty 'IsDomain' $False + } + else { + $_ | Add-Member Noteproperty 'IsDomain' $True + } } + $LocalUsers + } + catch { + Write-Verbose "Error retrieving machine SID for $Server" } - $LocalUsers } else { Write-Verbose "Error: $(([ComponentModel.Win32Exception] $Result).Message)"