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)
   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)

Link to comment
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)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...