I keep forgetting the syntax for this handy command so here it is at least for me to see.
User membership
dsget user "cn=username,ou=Users,dc=thinworld,dc=net" -memberof -expand >memberof.txt
Group membership
And to get a list of members of a group
dsget group "cn=groupname,ou=Users,dc=thinworld,dc=net" -members -expand >members.txt
Group Membership (SaMAccountname)
This does the same as above but converts the output the SamAccount name
DSGET group "cn=groupname,OU=groups,DC=thinworld,DC=net" -members -expand | dsget user -samid >members.txt
this is a very easy and working one
ReplyDeletedsquery user -samid %user% | dsget user -memberof -expand > bob.txt