A Few DSGet Commands

DSGet is a Windows command-line tool used to interact with Active Directory Domain Services (AD DS). I came across some commands I’d written down earlier this year and thought I’d post them here for later recall.

To list direct members of a group:

DSGet group "CN=GroupName, OU=OrganizationalUnit, DC=domain, DC=tld" -members

To list all of the group’s members (including members of a group that is a member of the group in question):

DSGet group "CN=GroupName, OU=OrganizationalUnit, DC=domain, DC=tld" -members -expand

To list the direct group membership of a user:

DSGet user "CN=UserName, OU=OrganizationalUnit, DC=domain, DC=tld" -memberof

To list full group membership of a user (like a recursive list, so-to-speak):

DSGet user "CN=UserName, OU=OrganizationalUnit, DC=domain, DC=tld" -memberof -expand

And a PowerShell command (cmdlet) to show the sAMAccountName(s) of the members of a group:

Get-ADGroupMember "GroupName" -recursive | Select sAMAccountName

I know this is far from an exhaustive list of commands, but at least now I can throw that ratty sheet of notebook paper away.