Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 6a71a6e

Browse files
authored
Update PowerView.ps1
Fixed null access control entry in results.
1 parent 2501e8e commit 6a71a6e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Recon/PowerView.ps1

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18814,13 +18814,15 @@ function Get-GPODelegation
1881418814
$Searcher.SearchScope = "Subtree"
1881518815
$listGPO = $Searcher.FindAll()
1881618816
foreach ($gpo in $listGPO){
18817-
$ACL = (([ADSI]$gpo.path).ObjectSecurity).Access | ? {$_.ActiveDirectoryRights -match "Write" -and $_.AccessControlType -eq "Allow" -and $Exclusions -notcontains $_.IdentityReference.toString().split("\")[1] -and $_.IdentityReference -ne "CREATOR OWNER"}
18818-
$GpoACL = New-Object psobject
18819-
$GpoACL | Add-Member Noteproperty 'ADSPath' $gpo.Properties.adspath
18820-
$GpoACL | Add-Member Noteproperty 'GPODisplayName' $gpo.Properties.displayname
18821-
$GpoACL | Add-Member Noteproperty 'IdentityReference' $ACL.IdentityReference
18822-
$GpoACL | Add-Member Noteproperty 'ActiveDirectoryRights' $ACL.ActiveDirectoryRights
18823-
$GpoACL
18817+
$ACL = ([ADSI]$gpo.path).ObjectSecurity.Access | ? {$_.ActiveDirectoryRights -match "Write" -and $_.AccessControlType -eq "Allow" -and $Exclusions -notcontains $_.IdentityReference.toString().split("\")[1] -and $_.IdentityReference -ne "CREATOR OWNER"}
18818+
if ($ACL -ne $null){
18819+
$GpoACL = New-Object psobject
18820+
$GpoACL | Add-Member Noteproperty 'ADSPath' $gpo.Properties.adspath
18821+
$GpoACL | Add-Member Noteproperty 'GPODisplayName' $gpo.Properties.displayname
18822+
$GpoACL | Add-Member Noteproperty 'IdentityReference' $ACL.IdentityReference
18823+
$GpoACL | Add-Member Noteproperty 'ActiveDirectoryRights' $ACL.ActiveDirectoryRights
18824+
$GpoACL
18825+
}
1882418826
}
1882518827
}
1882618828
}

0 commit comments

Comments
 (0)