Jump to content

issue getting members out of AD group

Recommended Posts


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)
Local $temp_array[0]
$objGroup = ObjGet($LDAP)
$arrMemberOf = $objGroup.GetEx("member")
For $strMember in $arrMemberOf
   $array = stringsplit($strMember, ",")
   $array2 = stringsplit($array[1],"=")
 Return $temp_array


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)

  • Like 1

My UDFs and Tutorials:


Active Directory (NEW 2017-04-18 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version - Download - General Help & Support

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.