diff --git a/scripts/ADDS/payload/scripts/04.Delegation of Control.ps1 b/scripts/ADDS/payload/scripts/04.Delegation of Control.ps1 index 3d19772..5cb1eef 100644 --- a/scripts/ADDS/payload/scripts/04.Delegation of Control.ps1 +++ b/scripts/ADDS/payload/scripts/04.Delegation of Control.ps1 @@ -66,11 +66,9 @@ If (@('primary','standalone') -contains $Parameter['deployment.type']) { ForEach ($Entry in $Delegations.DelegationEntries) { $GetADObjectSplat = @{ - Filter = '*' - SearchBase = 'DC=' + $Parameter['addsconfig.domainname'].Replace('.', ',DC=') - SearchScope = 'OneLevel' + Identity = $Entry.OrganizationalUnit + (($Parameter['addsconfig.domainname'] -split '\.' | ForEach-Object {',DC={0}' -f $_}) -join '') } - $OU = Get-ADObject @GetADObjectSplat | Where-Object {$_.DistinguishedName -match $Entry.OrganizationalUnit} + $OU = Get-ADObject @GetADObjectSplat $GetACLSPlat = @{ Path = "$($PSDrive.Name):\$($OU.DistinguishedName)" }