Offer

News We Recently Launched AD Migrator and AD Reporter.

How to Export Computer List from Active Directory Using PowerShell & More

  author
Written By Mohit Jha
Anuraag Singh
Approved By Anuraag Singh 
Published On November 13th, 2024
Reading Time 6 Minutes Reading

Many IT administrators often find themselves struggling while exporting computer lists from Active Directory. If you face the same then this is the right place – in this article, we are going to cover all the aspects and methods to perform this operation. Whether you know PowerShell, or command line, or prefer automated software, we are going to describe it all in detail.

Let’s begin with PowerShell and then introduce its alternatives as well. So that admins can select the method that best suits their skills and requirements. Without any further discussion, let’s dive in!

Method 1. PowerShell Script to Export Computer List from AD

Here is a simple script that can both provide you with an on-console visualization and export the results in the comma-separated format.

Step-by-Step Instructions to Export Computer List from Active Directory Using PowerShell:

  • Step 1. Open PowerShell with administrator privileges.
  • Step 2. Copy and paste the script below.
  • Step 3. The output will be saved to C:\ADComputers.csv.
Get-ADComputer -Filter * -Property Name,OperatingSystem,LastLogonDate | 
Select-Object Name,OperatingSystem,LastLogonDate | 
Export-Csv -Path "C:\ADComputers.csv" -NoTypeInformation

Export Computer List from AD Using PowerShell

PowerShell isn’t the only code-based method out there. Some of the veteran admins might get an inclination to what we are referring to. For others, the following section will provide the answer.

Method 2. Alternative Code-Based Methods to Get an AD Computer List Using Command Line (dsquery)

It is nothing but dsquery. Here is what you need to do before deploying the query

Step 1. Press the Win + R.

Step 2. Type cmd in the run dialog box

Step 3. Press Enter.

Step 4. This opens a new command line instance.

Step 5. There put in the following command and press enter.

dsquery computer -name * 

Step 6. To get this result out from the view only the cage append. 

“> C:\ADComputers.txt”

at the end

Step 7. To export the results to a text file, append the following:

dsquery computer -name * > C:\ADComputers.txt

Use Dsquery to Export Computer List from AD

You can change the folder path and add additional filters as needed.

If you are not comfortable with code you might as well use the Default programs present in your setup. More on that is explained below.

Method 3. Native Non-Code Method to Export Computer List from AD Using Active Directory Users and Computers (ADUC)

There are two distinct options available inside all Active Directory Environments first one is the Users and Computer portal. Given below are the instructions to use it.

Step 1. Open Active Directory Users and Computers (ADUC).

Step 2. Hit the Filter Icon.

Step 3. Enable Show only the following types of objects, and mark Computers and deselect the rest.

Step 4. Click on OK.

Step 5. Wait for the screen to refresh and browse to get the Computers and hit the Export list icon at the top part of your screen.

Step 6. This will open a new box where you have to type a file name, pick a format CSV/TXT), and hit Save.

How to Export Computer List from AD Using ADUC

Although this method sounds easy it has its fair share of problems let’s see what they are.

  • Despite filtering the ADUC is not advanced enough to segregate the list of desired objects at a single location. So admins still have to scan through the entire ADUC portal manually. As a result, admins end up with multiple CSV/TXT files.
  • Moreover, the filtering does not hide other objects entirely. For example, if you have a multi-tier OU structure where both the parent and Child OU have their own Computer list, then your export file will contain that child OU along with the computer object list.  

The CSV files themselves contain OU.   

If you want to spend less time editing CSV then there is another inbuilt alternative you can try within the Active Directory which is the Administrative Center.

Method 4: Using Active Directory Administrative Center (ADAC)

Step 1. Launch the ADAC

Step 2. Open up the Global Filter option.

Step 3. Toggle the LDAP tab and paste the following filter.

(&(objectClass=computer))

Step 4. Once you press the Apply button, it will get a filtered list of computers. 

Export Computer List from AD Using ADAC

You will get a Computer list. However, there is no Export option you have to manually select all results and Paste them into a spreadsheet program like Excel, or Google Sheets. Then use that program’s settings to get the CSV format report.

Method 5. Professional Way of  Exporting Computer Lists Out of the Active Directory

Use SysTools Active Directory Reporting Tool to see how many computer objects currently reside in your AD and prepare a report accordingly. 

Once set, it only takes a few clicks to know exactly where a computer object is present. Which can be provided in advice thanks to a specialized dashboard right within the tool itself.

Download Now Purchase Now

Just like when admins wanted computer object data in OU and Sub OU here, they can use this tool here as well. All you have to do is follow a few simple steps that are outlined below.

  • Step 1. Launch the tool on any workstation, and see how the default admin credentials fill on their own. These can be changed later from the settings portal.
  • Step 2. After this, click on the REGISTER DOMAIN CONTROLLER option if not visible use the small building icons at the top right corner.
  • Step 3. In the box that appears put in a Domain friendly name, and also mention the corresponding IP address. 
  • Step 4. Then go to the Domain Details page where you need to complete the admin credential validation,
  • Step 5. Click on the Reports tab and select the All option under the Computers workload.
  • Step 6. Inside the Reports screen tap the Preview button to get a glimpse at how the report will look like.
  • Step 7. Expand the Download button and select CSV. 
  • Step 8. Save the report on your machine.

Conclusion

Managing Active Directory requires that admins know how to export computer lists from AD. That’s why in this writeup we prepared a list of all available methods that can help you out. We included some technical code-based methods like the PowerShell and command line query. Those who find code troubling can complete the task using inbuilt AD GUI programs. Though by risking a fragmented report. As the best of both worlds, the tool combines speed with simplicity and is the most agile approach for listing out AD computers.

  author

By Mohit Jha

Meet Mohit, an accomplished professional serving as an Assistant Digital Marketing Manager and content strategist. As a content strategist, Mohit combines creativity and strategy to craft compelling narratives that captivate audiences and align with brand objectives. With a dual expertise in digital marketing and content strategy, Mohit is your trusted partner in achieving digital excellence.