More with the ldap cmdlets in NetCmdlets, here's how to list the members of a particular group.
I used the get-ldap command shown in the last post to get a list of all my admin groups, and save it in a $groups collection:
Of course if you already know exactly what group you want, you can just hard code that group DN and call the cmdlet. But I can get all of the members of all of the admin groups by looping through this $groups collection. Here's how to get all the members of the first group (CN=Administrators):
Note the use of the -attr flag in the cmdlet - this is to tell the cmdlet to return all the attributes resulting from the search. The reason I need to do this here is because all the members of the group will be contained inside the member attribute (or the memberUid or uniqueMember attribute depending on your server).
If I were to set a $result variable to the result of the command above, I could then examine $result.member to see all the members of the "CN=Administrators" group:
Technorati Tags: PowerShell, NetCmdlets, ldap, active directory