Sign in to follow this  
Followers 0
DaveR

Adfunctions error/ odd occurrence

3 posts in this topic

Hello,

While I obtain a number of groups (84) for a user, when I run this portion of the script it appears that the script runs through 4 times. I'm not sure if this why this is happening and I can't display what is contained in any of the objects (I'm faily new to autoit and haven't been able to find a command to do this yet).

Is it normal that the script would run through my array 4 times?

When I have more groups in my array (612) I get an error after 306 passes stating that the array has an incorrect number of subscripts or subscript range exceeded:

Any help or suggestions would be appreciated.

Thank you

Share this post


Link to post
Share on other sites



Can we see the code that is getting it 4 times maybe then we can help you out and also the pass through 612 and getting error on the 306


Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites

Can we see the code that is getting it 4 times maybe then we can help you out and also the pass through 612 and getting error on the 306

adfunctions.au3 code that is being used:

CODE
Func _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:

CODE
dim $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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0