Using DSQUERY to find distinguished names in Active Directory

If you ever need to find the distinguished name of a user in Active Directory, you can use the following DSQUERY command.

DSQUERY.exe * -limit 0 -filter "(&(objectCategory=Person)(objectClass=User)(!userAccountControl:1.2.840.113556.1.4.803:=2))" > "c:\activeUsers.txt"

The above command will output all of the active users in the current login name to a text file called activeUsers.txt in the root of the C: drive.

Bookmark and Share
Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]

Performance Optimization WordPress Plugins by W3 EDGE