News We Recently Launched AD Migrator and AD Reporter.

How to Export Computer List from AD Using PowerShell & More

  author
Written By Mohit Jha
Anuraag Singh
Approved By Anuraag Singh 
Published On October 3rd, 2024
Reading Time 5 Minutes Reading

There are quite a few admins who don’t know how to export computer list from AD and if you are among those then dont worry. We have arranged a list of methods that will help you figure out exactly how many computer objects are inside your Active Directory environment. We begin with PowerShell and introduce its alternatives as well. So that admins can select the method that best suits their skills and requirements. Without further ado let’s start.

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-separate format.

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.

Alternative Code-Based Methods to Get an AD Computer List

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

  • Press the Windows Key together with the R key.
  • Type cmd in the run dialog box
  • And Press Enter.
  • This opens a new command line instance.
  • There put in the cls command and press enter to clear the screen.

Then type:

dsquery computer -name * 

To get this result out from the view only the cage append 

“> C:\ADComputers.txt”

at the end

So the full query becomes

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.

Native Non-Code Method to Export Computer List from AD

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.

  • Open ADUC.
  • Hit the Filter Icon.
  • Enable “Show only the following types of objects”.
  • Mark “Computers” and deselect the rest.
  • Click on OK.
  • 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.
  • This will open a new box where you have to type a file name, pick a format, 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.

  • Launch the ADAC
  • Open up the Global Filter
  • Toggle the LDAP tab and paste

(&(objectClass=computer))

  • Once you press the Apply button 

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.

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.

  • 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.
  • After this, click on the REGISTER DOMAIN CONTROLLER option if not visible use the small building icons at the top right corner.
  • In the box that appears put in a Domain friendly name, and also mention the corresponding IP address. 
  • Then go to the Domain Details page where you need to complete the admin credential validation,
  • Click on the Reports tab and select the All option under the Computers workload.
  • Inside the Reports screen tap the Preview button to get a glimpse at how the report will look like.
  • Expand the Download button and select CSV. 
  • 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.