Friday 19 June 2009

DSGET command to list users group membership

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

1 comment:

  1. this is a very easy and working one

    dsquery user -samid %user% | dsget user -memberof -expand > bob.txt

    ReplyDelete