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

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

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.

Recommended Tool: Permissions Analyzer for Active Directory

This FREE tool lets you get instant visibility into user and group permissions and allows you to quickly check user or group permissions for files, network, and folder shares.

You can analyze user permissions based on an individual user or group membership.

This is a Free tool, download your copy here.

Leave a Comment