---
title: "Get-ADComputer: Find Computer OUs in Active Directory"
description: "Explore how get-adcomputer, the sibling of Get-ADUser, finds computer OUs instead of users in Active Directory."
canonical: "https://adamtheautomator.com/get-adcomputer/"
---

# Get-ADComputer: Find Computer OUs in Active Directory

> Explore how get-adcomputer, the sibling of Get-ADUser, finds computer OUs instead of users in Active Directory.

Source: https://adamtheautomator.com/get-adcomputer/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Get-ADComputer: Find Computer OUs in Active Directory](https://adamtheautomator.com/wp-content/uploads/2019/06/Active-Directory-Logo.jpg)

# Get-ADComputer: Find Computer OUs in Active Directory

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)17 June 20193 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[PowerShell](/tag/powershell/)

Table of Contents

*   [The Basics](#the-basics)
*   [The Identity Parameter](#the-identity-parameter)
*   [The Filter Parameter](#the-filter-parameter)
*   [The LDAPFilter Parameter](#the-ldapfilter-parameter)
*   [Finding Computers in an OU](#finding-computers-in-an-ou)
*   [Getting Accounts in Child OUs](#getting-accounts-in-child-ous)
*   [Summary](#summary)

For today’s cmdlet, we’re going to focus on `Get-AdComputer`. This cmdlet is the brother of [Get-AdUser](https://adamtheautomator.com/get-aduser/). Instead of getting users from Active Directory (AD), this cmdlet finds computers in OUs.

You’ll find the `Get-AdComputer` cmdlet in the ActiveDirectory PowerShell module. If you don’t already have that installed, find out how [here](https://adamtheautomator.com/powershell-import-active-directory/).

> Today’s sponsor is ScriptRunner, your #1 platform to accelerate your IT automation with PowerShell. They offer a FREE PDF cheat sheet, designed to be your go-to guide for the most important and frequently used Active Directory cmdlets. _[Download for free](https://lp.scriptrunner.com/en/active-directory-cheat-sheet?utm_campaign=Cheat%20Sheets&utm_source=ATA&utm_medium=cpm&utm_content=Active%20Directory)_

## The Basics

If you’ve never used the `Get-AdComputer` cmdlet before, ensure you understand the basics. You’ll search for and retrieve computers using the `Identity` and `Filter` parameters.

### The Identity Parameter

At it’s most basic, Get-Adcomputer gets a single computer object from AD using the `Identity` parameter. If you had a computer called FOO, then you’d provide that value as shown below.

```powershell
Get-AdComputer -Identity FOO
```

By default, the cmdlet will only return a few AD attributes. If you’d like to see all AD attributes for a computer, use the `Properties` parameter.

By using an asterisk with the `Properties` parameter below, PowerShell will return _all_ AD attributes. But if you only want to see a few of them, you can specify them, comma-delimited.

```powershell
Get-AdComputer -Identity FOO -Properties *
```

> _Like all other Active Directory PowerShell cmdlet Identity parameters, you can also specify a distinguished name (DN), GUID, or a SID._

### The Filter Parameter

If you need to find more than one computer account, use the `Filter` parameter. The `Filter` parameter is a common parameter amongst many ActiveDirectory commands. It allows you to specify conditions an account must meet to be returned.

If not using the `Identity` parameter, you _must_ use the `Filter` parameter. If, for example, you’d like to find all computer accounts in AD, you can specify an asterisk. The asterisk is a wildcard that matches all computer accounts.

```powershell
Get-AdComputer -Filter *
```

Perhaps you need to find all computers starting with the letter “F”. In that case, you’d craft the filter syntax as shown below.

```powershell
Get-ADComputer -Filter "Name -like 'F*'"
```

### The LDAPFilter Parameter

If you’re good at LDAP filters, you can also use the `LDAPFilter` parameter. The LDAP filter allows you to use LDAP syntax to hone in on exactly the computer you’re looking for. `LDAPFilter` can be used with the `SearchBase` parameter or by itself.

Below, I’m using the LDAP filter to find all computers that start with _F._

```powershell
Get-ADComputer -LDAPFilter "(name=f*)"
```

> _For more information on building filters, check out [Learning Active Directory and LDAP Filters in PowerShell](https://adamtheautomator.com/ldap-filter/)._

## Finding Computers in an OU

Finding computers by name with the `Identity` parameter or by various AD attributes with the `Filter` parameter is only one option. You can also find computer accounts by the OU they’re located in.

Get-Adcomputer has a `SearchBase` parameter you can use to limit the search only to an OU and/or all of its child OUs.

Perhaps you need to find all domain controllers in the Domain Controllers OU. You could limit the scope of computer accounts returned to only these machines using the `SearchBase` parameter.

The `SearchBase` parameter defines a “start” to searching. Rather than starting a search at the root of the domain, it tells PowerShell to start at an OU.

To use the `SearchBase` parameter, you specify an OU’s distinguished name (DN). Below is an example of finding all computer accounts in a Domain Controllers OU in a _company.pri_ domain.

```powershell
Get-ADComputer -Filter * -SearchBase 'OU=Domain Controllers, DC=company, DC=pri'
```

#### Getting Accounts in Child OUs

When you use the `SearchBase` parameter, PowerShell only returns computer accounts in that specific OU. It will not return computer accounts in any child OUs. To do that, you can use the `SearchScope` parameter.

The `SearchScope` parameter allows you to define how deep to look from the parent OU. This parameter has three possible values – `0`, `1` and `2`. By default, it is set to `0` and will only return computers in the base OU.

If you need to recursively search in the base OU and the immediate child OU, you can use the `1` value. The most common value here though is `2` meaning to recursively search through all child, grandchildren and deeper OUs.

```powershell
Get-ADComputer -Filter * -SearchBase 'OU=Domain Controllers, DC=company, DC=pri' -SearchScope 2
```

## Summary

`Get-AdComputer` is a handy cmdlet to find information about AD computer accounts. You’ll have the biggest challenge not learning how to use `Get-AdComputer` but figuring out the filtering syntax. If you read the linked filter article above, you’ll see it can get complicated.

Once you master the filter, you’ll then easily be able to pull as much information as you need from AD computer accounts!

These are some of the most common use cases for this cmdlet of the day. For a full breakdown, check out the [Microsoft documentation](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/ee617192\(v=technet.10\)?redirectedfrom=MSDN).

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fget-adcomputer%2F&text=Get-ADComputer%3A%20Find%20Computer%20OUs%20in%20Active%20Directory)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fget-adcomputer%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fget-adcomputer%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2026/06/26995-troubleshoot-dns-issues-powershell-codex.webp)

### [Troubleshoot DNS Issues with PowerShell](/troubleshoot-dns-issues-powershell/)

Troubleshoot DNS issues with PowerShell by testing name resolution, DNS client settings, cache entries, and network connectivity in a repeatable workflow.

![](https://adamtheautomator.com/wp-content/uploads/2025/10/image_2025-10-24_095322075.png)

### [Migrating from PowerShell 6 to 7.5: Breaking Changes/New Features](/migrating-powershell-6-to-7-5/)

Migrate from PowerShell Core 6 to 7.5: breaking changes, features, and testing tips.

![](https://adamtheautomator.com/wp-content/uploads/2025/06/featured-image-6.png)

### [How to Add Timeouts to Pester Tests with PowerShell Runspaces](/pester-test-timeout-runspaces/)

Prevent Pester tests from hanging indefinitely using PowerShell runspaces. Learn to handle variable scoping, module loading, TestDrive access, and stream capture challenges with timeout protection.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
