Link to home
Start Free TrialLog in
Avatar of lgmmiller
lgmmiller

asked on

Querying AD for name

I want to create a query using dsquery that outputs to a txt file the username and name of all users in AD.

Any help greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of SysExpert
SysExpert
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Joemonkey
Joemonkey

I have this in a batch file and run it weekly or so.  It gives their first name, last name, and logon (or samaccountname if you prefer).  You'll obviously have to edit the OU line

dsquery user -name * "OU=All Users,DC=domain,dc=net" -limit 5000 | dsget user -fn -ln -samid > \\server\share\users.txt