Active Directory:Dsquery Commands

Dsquery按照指定的条件查询Active Directory


下面我仅摘录了部分内容,查看完成文档请点击以下链接,或者点击附件进行下载查看完整内容

http://social.technet.microsoft.com/wiki/contents/articles/2195.active-directory-dsquery-commands.aspx


 1. How to find all members for a particular group.

  dsget group "<DN of the group>" -members

  a. How to find all groups for a particular member (including nested groups)

  dsget user "<DN of the user>" -memberof -expand
  dsquery user -samid "username" | dsget user -memberof -expand

   b. Get the Groups name form Users container
   dsquery group -o rdn cn=users,dc=contoso,dc=com
  
   C. Get the members from a Group
   dsquery group -samid "CS_CLUB_ACCOUNTS" | dsget group -members -expand  | dsget user -samid  

2. How to find memberof , lastlogontimestamp , homemta(Mail server) , Samaccountname & so on(Repadmin /showattr <DCname> <"DN">)

 dsquery * "<DN>" -scope base -attr lastlogontimestamp memberoff 

 repadmin /showattr <DCNAME> <"DN"> /attrs:lastlogon,homemta,whencreated,lastlogontimestamp,samaccountname

3. How to modify user last name.

 dsmod user <dn> -ln "<last name>"

 

你可能感兴趣的:(Directory,Active)