Last Updated on July 17, 2014 by Dishan M. Francis
In today post lets look in to another DS command which we can use to administer active directory. The command is "DSGET" it is also use to query about AD objects.
What is different between DSQUERY and DSGET ?
When you run DSquery you can get set of objects as results. for example if you need to list all the users starts name with "Sales" you can use DSquery command to list similar objects and find the exact object you need. but DSget use to list properties of a object. for example if you need to fine email address of user "Sales A" you can use DSget command for it. But to do that you need to know Distinguish Name (DN) of the object. So this is the reason why this command less popular among engineers.
DSGET Hlp file can open using dsget /? This commands need to be run as administrator on DC server.
Lets look in to some of examples,
The first sample command i will use is dsget user "CN=Sales A,OU=Sales Department,DC=contoso,DC=com" -email. in here dsget user defines that the query is going to based on object type Users. so in this i am trying to find email address of the Sales A user. CN=Sales A,OU=Sales Department,DC=contoso,DC=com is the DN for the user Sales A.
As it is showing on the above it is display the email address of the user as the result.
The next sample command is dsget group "CN=Sales Leads,OU=Groups,DC=contoso,DC=com" -members, This is for list all the members of the Ad user group called "Sales Leads" , in command dsget group defines the object type as group and CN=Sales Leads,OU=Groups,DC=contoso,DC=com is the DN for the user group.
According to the command it list down the 2 users in the group successfully.
This is the end of this post and lets look in to another DS command in next post.