Using command to list all members of AD

In Windows Server 2003 ,using Dsget command  for getting information about objects stored in AD, including groups. When you use Dsget with the -members switch, it will output the distinguished names (DNs) of all the members of a group.

Syntax
DSGet Computer
DSGet Contact
DSGet Group
DSGet OU
DSGet Partition
DSGet Quota
DSGet Server
DSGet Subnet
DSGet User

Examples for Dsget user

To find all users in an organizational unit (OU) named Test whose name starts with “jon” and to show their descriptions, type:

dsquery user OU=Test,dc=ms,dc=tld -name jon* | dsget user -desc

To show the list of groups, recursively expanded, to which the user Mike Danseglio belongs, type:

dsget user “CN=Mike Danseglio,CN=users,dc=ms,dc=tld” -memberof -expand

Examples for Dsget group

To display the descriptions of all groups in an organizational unit (OU) named Test whose names start with “adm,” type:

dsquery group OU=Test,DC=Contoso,DC=Com -name adm* | dsget group -desc

To display the list of members, recursively expanded, of the Backup Operators group, type:

dsget group “CN=Backup Operators,OU=Test,DC=Contoso,DC=Com” -members -expand

Examples for Dsget server

To find all domain controllers for domain widgets.contoso.com and then display their DNS host names and site names, type:

dsquery server -domain widgets.contoso.com | dsget server -dnsname -site

To see if a domain controller named DC1 is also a global catalog server, type:

dsget server CN=DC1,CN=Servers,CN=Site10,CN=Sites,CN=Configuration,DC=Contoso,DC=Com -isgc

To show the distinguished names of the directory partitions on a domain controller named DC1, type:

dsget server CN=DC1,CN=Servers,CN=Site10,CN=Sites,CN=Configuration,DC=Contoso,DC=Com -part

To show the top five security principals that own the most objects on the domain controller DC1.widgets.contoso.com, type:

dsget server CN=DC1,CN=widgets,DC=Contoso,DC=com -topobjowner 5

Read more http://technet.microsoft.com/en-us/library/cc755162%28WS.10%29.aspx

Advertisements

Posted on January 22, 2012, in Uncategorized, Windows. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: