Active Directory Users and Computers by going to Start menu > Administrative tools > Active Directory Users and Computers:
An AD administrative tool will appear. Choose the name of your domain and go to “Users”
A complete list of users will appear. However, there are also Security and distribution groups included. To get rid of them, use filters. Instead of showing all types of objects, choose “show only the following types of objects”, check “users” and click the OK button.
The list will be shorter now. The next step is choosing which attributes to export to a csv file. Now, which fields you choose depends on what you need your CSV file for.
We just require
Choose name and Email Address for creating a migration batch, or the attributes you can see in the picture above if you want to bulk add users in Office 365. As you can probably see, not all attributes from the previously mentioned template file can be listed. That is why you will need to edit the CSV file manually. But before that, click OK to apply the changes.
By clicking on “Export list” in the top menu, you can finally export your users. You just have to name the new file and make sure that it is saved in *.csv format.
If you open the file in Excel, it will probably be delimited with commas, but just in one column. To make editing easier, use a “Text to Columns” function and follow the wizard.