Friday 12 August 2016

How to export active directory users list without any additional tool, powershell or script?

Or, The easiest and the coolest way of exporting All AD users list to csv file.
Or, Getting list of all AD users using active directory GUI interface and exporting them to csv/txt file.
Or, How to export AD users list to a txt or csv file?

Descriptions:
I don’t know why Microsoft does not highlight these kind of features well to the techies across the world. Trust me, it has been too late if you really don’t know “you can export AD users, Computers, Groups, Disabled AD Users etc.. without any additional tool”. Yes, I am right, without any additional tool you can have such reports exported to a CSV or TXT file using Active Directory Query feature.

I am not surprised, if you are thinking where the hell this “Active Directory Query” features is and how to use this? Same thing runs in to my mind when I come to know about this feature for the first time. :)

Guys, have you noticed “Saved Query”, a small folder under “Active Directory Users and Computers”  tree when you open “Active Directory Users and Computers” management console either by opening it directly from Server Manager or by using “dsa.msc” from your local computer?

No??? Okay, No problem at all. Let me explain little bit about this.

What is this “saved query” folder for under “Active Directory Users and Computers” management console?
This folder is the one which contains the saved queries when you use any active directory based query to get Active Directory objects reports using GUI feature of Active Directory Query tool. From here, you can generate many kind of reports, let me say it most of the available reports in AD.

How to use this?
There is no scripting, programming or Powershell expertise required for performing this task. If you have basic idea about AD objects, you can perform these steps easily.

Warning:  If you are not sure about any feature or query you are selecting/executing, better you consult your seniors before going ahead. Proceed with further steps only if you understand the steps to avoid any accidents else ignore this.

Steps:
Open Active Directory Users and Computers Console > Right Click on “Saved Query” Folder













Click on New > Query



















Give any friendly name > Make sure your domain in selected under Query root section > Make sure “Include subcontainers” is checked > Click on “Define Query”.
























From the Find drop down menu, Select “Custom Search















Click on “Field















Choose the field you wish (in my case, Let’s take “User” field) > Choose “Display Name” in the sub-fields window
























Make sure the first blank box is containing the field you selected (in our case, its Display Name) > in the value field, please put a single star (*) > Click on OK















You should be able to see the Query String section like as highlighted in below screenshot > Click OK























Wow...!!! here you have the list of all AD users of your domain.
















To export them to a txt or csv file, right click on your query that you created (in my case its AllUsersMyDomain) > Click on Export List






















Browse the computer location where you wish to save this file > Select the desired file format > Click on Save.


















That’s it Guys… want to explore more on this query tool? Just follow the same steps and select any other custom field.

Cheers, please write me back if you have any query or feedback about this article. 

2 comments:

  1. You saved me. Thank you. Can you also show on how to Identify within AD by using saved query which User belongs to which Server

    ReplyDelete
  2. Hello, Glad that it helped you..

    In domain environment, users belongs to Domain not from any specific server. Yes, you can think of having logon workstations details of users at any specific point of time but that may give you random result each time you run the query.

    If your query is still unanswered, please explain your requirement in more detail..

    ReplyDelete