If you need a quick way to export all user accounts in Active Directory to a file, follow these simple steps.
IMPORTANT NOTE: You must be logged in to a Domain Controller to enumerate all AD accounts, if you run this locally/on a non-domain controller, it will enumerate only local accounts on that machine.
IMPORTANT: Make sure you’re logged in to a domain controller via RDP or directly on the console.
net users >userlist.txt
The output file userlist.txt will save to your current directory.
- Windows 2000 Server
- Windows 2003 Server
- Windows 2008 Server
- Windows 2012 Server