Retrieve AD group members

I’m trying to export Active Directory group members using “Get Object Properties” with singleproperty “member”. The value that I am getting back is system.object. How can I convert that to something that is enumerable; that way I can see all of the different members?

Or, is there an alternate way of doing this? Goal is to generate a .CSV file containing all of the members in an AD group.


image

The output System.Object[] is an Array of Objects. Try logging strGroupMembers.Length.ToString() to see how many objects are in the Array. You can go through them one-by-one by using strGroupMembers as the value in a For Each loop.

@PhilC

To get the first value of the array for log message

you can use strGroupMembers(0)

Use Build Datatable Activity

You can use For each to loop all into array

In For each loop use Add Data Row activity and give the values retrived from Foreach

Once its complete you can use write csv activity

Mark as solution if this helps you

Thanks

Thanks for the suggestions, but it did not bear fruit. Any other suggestions?

strGroupMembers.Length.ToString()
image

For Each Loop:
image

strGroupMembers(0)
image

This Object doesn’t seem to have a lot of options:
image

@PhilC

Use strGroupMembers.Count, as it is a array you get the count of the elements inside the array

Hope this helps you

Thanks

hi

Can you do below change and try…

in foreach change the type argument “object” to “System.Collections.IEnumarable”

image

Thanks…