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.

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.

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.

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.

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.

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.

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.

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.

9. Get All Computers lastlogondate
Get-ADComputer -Filter * -properties * | select name,lastlogondate
This command gets all domain computers and displays the lastlogondate value.

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).

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.