Get-ADComputer: How to Get All AD Computers with PowerShell

by Robert Allen

In this post, I’ll show you several examples of the Get-ADComputer PowerShell command. This command is used to search active directory to get single or all computer accounts. I’ll also show you how to use the Get-ADComputer filter option to limit results based on specific computer properties (for example, the name, OU, and modified date).

Let’s get started.

Get-ADComputer Examples

1. Get All AD Computers

get-adcomputer -filter *

This command will get a list of all computers in the domain.

get all computer accounts

2. Get All Computers with all properties

get-adcomputer -filter * -properties *

This command will get all computers and all of the computer properties (attributes). By default, the get-adcomputer command only displays 8 properties. You must use the -properties * command to list them all.

get all computers and all properties

3. Get All Computers from an OU

Get-ADComputer -Filter * -SearchBase "OU=ADPRO Computers,DC=ad,DC=activedirectorypro,DC=com" 

This command will get all computers from a specific OU by using the -SearchBase parameter and the distinguishedName of the OU.

get all computers from ou

4. Get All Computers and Show Specific Properties

Get-ADComputer -Filter * | select name, Enabled

This command will get all computers and limit the output to display the name and enabled properties only.

get all computers status

5. Get All Enabled Computers

Get-ADComputer -Filter "Enabled -eq 'True'"

This command uses the -filter option to limit the results to only enabled computers.

get all enabled computers

To limit the properties use the select option followed by the properties you want to display.

Get-ADComputer -Filter "Enabled -eq 'True'" | select Name, Enabled

6. Get All Disabled Computers

Get-ADComputer -Filter "Enabled -eq 'false'" | select Name, Enabled

This command filters for enabled computers and limits the output to the name and enabled properties.

get all disabled computers

7. Get All Computers with a specific Name (Wildcard Search)

Get-ADComputer -Filter "Name -like 'SRV*'" | select Name, Enabled

This command searches for computers that start with srv in the name field.

filter computers by name

8. Get All Computers and IP Addresses

Get-ADComputer -Filter * -properties * | select Name, Enabled,ipv4address

This command gets all computers and displays the IP address of each computer.

get all computers and ip address

9. Get All Computers lastlogondate

Get-ADComputer -Filter * -properties * | select name,lastlogondate

This command gets all domain computers and displays the lastlogondate value.

get all computers lastlogondate

10. Get All Computers Last Modified Date from an OU

Get-ADComputer -Filter * -SearchBase "OU=ADPRO Computers,DC=ad,DC=activedirectorypro,DC=com" -properties *| select name, whenchanged

This command will get all computers from a specific OU and display the computer’s last modified date (whenchanged attribute).

all computers from an ou and modified date

Easily Get AD Computers with the AD Pro Toolkit

The AD Pro Toolkit includes over 200 built-in Active Directory Reports for users, computers, groups, GPOs, and security. You can easily get all domain computers or computers from an OU.

You can customize the reports and build your own reports with the report builder.

Download AD Pro Toolkit and see how easy it is to create computer reports.

I hope you found this article useful. If you have questions or comments, please post them below. Refer to the Microsoft documentation to view the complete get-aduser syntax.

Related Articles

7 thoughts on “Get-ADComputer: How to Get All AD Computers with PowerShell”

  1. Vlad

    Here:
    get-adcomputer -filter * -Properties name, enabled | select name, enabled

    there is no need to use “-Properties name, enabled”, because these are standard properties that exist anyway.

    Reply
  2. Sergei

    Thanks a lot for the tips! included the one in commentaries. They are very useful!

    Reply
    • Avatar photo
      Robert Allen

      Hi, Sergei.

      You are welcome.

      Reply
  3. Dayna

    PS C:\Windows\system32> get-adcomputer -filter *
    get-adcomputer : The term ‘get-adcomputer’ is not recognized as the name of a cmdlet, function, script file, or
    operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
    again.
    At line:1 char:1
    + get-adcomputer -filter *
    + ~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (get-adcomputer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    Reply
    • Avatar photo
      Robert Allen

      get-adcomputer requires the PowerShell Active Directory module? Do you have the RSAT tools installed?

      Reply
  4. Scott Johnstone

    This works in small environments in large environments running Get-Adcomputer -filter * and -Properties * will fall over.

    Reply
    • Avatar photo
      Robert Allen

      In large environments I would not use -properties *, instead list only the properties you need.

      get-adcomputer -filter * -Properties name, enabled | select name, enabled

      Reply

Leave a Comment