How to get the list of computer accounts in an Active Directory domain using Powershell

There is no specific PowerShell cmdlet or script to fetch all computers accounts in a specific Active Directory (AD) domain. You will have to use the Get-ADComputer cmdlet, and use the right parameters and filters to get the desired list of AD computer accounts. For example, to get all computers in a domain you will have to use a filter; to get all inactive computers you will have to fetch the list based on the last logon time parameter; the operating system parameter to fetch computers running on a specific OS, and so on.

In short, every time you wish to get a list of computers that match a specific criteria, you will have to create a new PowerShell script or create a new one. On the other hand, ADManager Plus, a purely GUI-based AD, Office 365, and Exchange management and reporting solution, offers predefined computer reports to list all computers matching a specific criteria, like all computers, all workstations, recently created/modified/deleted computers, etc. at just the click of a button. This article compares the process of getting the list of all computers in an AD domain using PowerShell and ADManager Plus to show how ADManager Plus is easily the best option.

Windows PowerShell

Steps to get all AD computers in a domain using PowerShell.

  • Ensure you have the necessary permissions to perform this action, and also to execute PowerShell scripts.
  • Create the script using the Get-ADComputer cmdlet, and execute it in the PowerShell window.

A sample PowerShell script to enable an AD account

 Copied
Get-ADComputer -Filter*
Click to copy entire script

This script will list all the computers in the domain. If you wish to export the report in a specific format, the script has to be modified, by adding the required format and the location to store the exported file.

ADManager Plus

To list all computers in an AD domain.

  • Select the All Computers report from Computer Reports in the Reports tab.
  • Select the domains from which you wish to get all AD computers, and click Generate. Click the Export as option and select the format to export the report.

Screenshot

List all Active Directory computer objects using ADManager Plus

» Start 30-day Free Trial

Right from the report, you can enable/disable/delete computers, modify their attributes and more, using the report's built-in management options.

Limitations of using PowerShell to get AD computers list

  • You will not be able to generate all AD computers report using PowerShell if you do not have enough privileges in the AD domains from which you wish to generate this report. With ADManager Plus, users privileges in native AD or Exchange doesn't have to be elevated to enable user AD accounts.
  • To export the report in a specific format using PowerShell, the script has to be modified. With ADManager Plus though, there is a built-in Export as option which allows you to export the report in CSV, PDF, HTML, or CSV format at just the click of a mouse button.
  • If you wish to search the generated AD computers report, the PowerShell script doesn't offer any option.Nor does it offer any means to manage the computers from the report. ADManager Plus on the other hand offers a built-in search and on-the-fly management actions in all its reports to locate any computer easily and move, enable/disable, delete, or reset the desired computer accounts or modify their attributes, right from the report.
  • You must know how to run the scripts from the PowerShell window. ADManager Plus is purely GUI-based, allowing you to perform all management and reporting actions with just mouse clicks from its web-based console.
  • Just a misplaced hyphen, or a misspelt LDAP attribute name could cause errors. ADManager Plus lets you perform all the desired management and reporting operations with purely mouse-clicks based actions.
  • Embark on your script-free AD management, reporting, and automation journey with ADManager Plus.
  •  
  • By clicking 'Start your free trial now', you agree to processing of personal data according to the Privacy Policy.
  • Thanks
  • Your download should begin automatically in 15 seconds. If not, click here to download manually.

Related Powershell How-to Guides:

Email Download Link