This repository was archived by the owner on Jan 21, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments