Altayr

issue getting members out of AD group

2 posts in this topic

Hi all,

been a while since I wrote any kind of code,
but recently we are required to check differences between 3 groups,
these should be identical, but since this is managed by the client of the application itself it most of the time isn't  (who would suspect that)

to compare the groups we used a tool, but this is an irritating work around,
so I tried to write a small piece of code that just needs to run and will throw back an txt file with the differences.
Below is the part I use to get all the members out of the groups, 
but I stumble upon a problem:

all 3 groups contains well over 3000 members,
by using the code below I get 3 arrays, all 3 are capped at 1500 entries.

I can't pinpoint the reason why they are capped so I was hoping someone could tell me where it goes wrong and point me in the correct direction to avoid this issue

 

#include <Array.au3>
$array_Group1 = GetMembersInGroup("LDAP://CN=Group1,OU=Organisations,DC=example,DC=com")
$array_Group2 = GetMembersInGroup("LDAP://CN=Group2,OU=Organisations,DC=example,DC=com")
$array_Group3 = GetMembersInGroup("LDAP://CN=Group3,OU=Organisations,DC=example,DC=com")


Func GetMembersInGroup($LDAP)
   MsgBox(0,"",$LDAP)
Local $temp_array[0]
$objGroup = ObjGet($LDAP)
$objGroup.GetInfo
$arrMemberOf = $objGroup.GetEx("member")
For $strMember in $arrMemberOf
   $array = stringsplit($strMember, ",")
   $array2 = stringsplit($array[1],"=")
    _ArrayAdd($temp_array,$array2[2])
 Next
 Return $temp_array
 EndFunc

 _ArrayDisplay($Group1)
 _ArrayDisplay($Group2)
 _ArrayDisplay($Group3)

Share this post


Link to post
Share on other sites



To work with AD you could use my AD UDF (for download and wiki links please see my signature).

To compare two AD groups I have a tool that allows to check members of one, both or neither group.
Please check ADCG in the example scripts section (for link please see my signature)

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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