Trouble enumerating group membership with dsquery/get
Posted on 2010-01-06
I am trying to enumerate the users in several domain groups. The groups contain nested groups, so I need to expand those as well. The output that I need is the RDN of the user object, but I am running into two issues.
This is the command I am attempting to run:
dsquery group -name "GROUPNAME" | dsget group -members -expand | dsquery user -o rdn
It takes the command fine, but just comes back with a full domain list of everyone's RDN.
If I just run: dsquery group -name "GROUPNAME" | dsget group -members -expand, it works fine, but the output is the full DN.
The other issue I am running into is more minor, but the output of the dsget group -expand command also outputs the nested group name. Is there anyway to omit this?
I know there are probably tools to handle this type of reporting, but I am interested in seeing it work in the native command line.
Thank you for any assistance!