adfunctions.au3 code that is being used:
CODEFunc _ADHasFullRights($object, $user = @UserName)
Dim $hfr_groups
If $user = @UserName Then
$hfr_groups = $loggedonusergroups
Else
_ADGetUserGroups($hfr_groups, $user)
EndIf
$oObject = ObjGet("LDAP://" & $strHostServer & "/" & $object)
If IsObj($oObject) Then
$security = $oObject.Get ("ntSecurityDescriptor")
$dacl = $security.DiscretionaryAcl
For $ace In $dacl
$trusteearray = StringSplit($ace.Trustee, "\")
$trusteegroup = $trusteearray[$trusteearray[0]]
For $i = 0 To UBound($hfr_groups) - 1
If StringInStr($hfr_groups[$i], "CN=" & $trusteegroup) And $ace.AccessMask = 983551 Then Return 1
Next
Next
EndIf
$oObject = 0
$security = 0
$dacl = 0
Return 0
EndFunc ;==>_ADHasFullRights
My code to call on this function:
CODEdim $testarray
_ADGetObjectsInOU($testarray,"ou=***,ou=***,dc=***,dc=***","(objectClass=Grou)",2,"distinguishedName","distinguishedName")
dim $cntGrps = Ubound($testarray)
For $i = 1 to $cntGrps
if ($i > 300) then MsgBox (1,$i,$testarray[$i] ;This was put in place to be able to see where the error cut out
$isAdm = _ADHasFullRights($testarray[$i], @UserName)
if ($isAdm = 0) then _ArrayDelete($testarray, $testarray[$i])
Next
_ArrayDisplay($testarray)
Thanks again for any help or advice.