Wednesday, October 30, 2013

DSQuery Best tool for Active Directory Attributes

There are multiple tool for Active Directory, but DSQuery is a one of the best tool for querying Active Directory however the syntax is a little tricky and difficult to use especially if you are not using daily basis.  This is only a small post to reference the syntax to query all Active Users in the domain to display only two attributes:

  • The users display name
  • The users department
Dsquery * -filter "(&(objectCategory=person)(objectClass=user)(!userAccountControl:1.2.840.113556.1.4.803:=2))" -attr displayname,department

No comments:

Post a Comment