How to List User Names and Emails from a Windows Domain to a file

This is a quick and easy way to get a Tabbed list of Usernames and emails from a Windows Domain while on the domain controller.

By using the dsget and dsquery commands, we can list users and then send the output to a file.

dsquery user cn=Users,dc=domain,dc=com -name * -limit 0 | dsget user -display -email > userlist.txt

Dsquery hits ldap and pulls the records, dsget pulls the interesting info from those records and we just use plain old CLI to sent the output to a file.

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Solve : *
1 × 13 =