http://www.computerperformance.co.uk/Logon/DSquery_user.htm#Example_1:_DS_Query_User_To_Find_All_Users
Show all user objects to a text file:
dsquery user -limit 0 > users.txt
https://gallery.technet.microsoft.com/scriptcenter/Generate-Excel-report-48c3f3b4