views:

248

answers:

2

I get the members of a AD group, but instead of the user name, im getting the display name. How can i get the user name?

+1  A: 

Look for sAMAccountName in the properties you get back.

Martin
there is no such property when i get group object.There is "member" which is the display name with some additional details.
Tamir
A: 

Well, i think this might be impossible, as the only users related property is the "members". So as a workaround i used the DirectoryService with the "member" property value to fetch the user again from the AD and get it's sAMAaccoundName. I'll be happy to hear about another solution to save the call to the AD for each user except the first call. Thanks

Tamir
Perhaps if you search active directory for users with memberOf = 'dn of group' you can get the sAMAccountName directly? Maybe it requires two searches because you are searching for the group first, and looking at the member property of the group (which is only the dn of each user).
Martin

related questions