# OU at domain root count should be retrievable

This test counts OUs that are direct children of the domain root (e.g., DC=maester,DC=test).

Source: https://maester.dev/docs/tests/AD-OU-02

<!-- This file is generated by website/scripts/generate-test-docs.mjs. Do not edit manually. -->

<div class="test-byline"><div class="test-byline-avatars"><a class="test-byline-avatar test-byline-avatar--author" href="/contributors/soulemike" title="Michael Soule · Original author"><img src="https://github.com/soulemike.png" alt="Michael Soule" width="28" height="28" loading="lazy" decoding="async" /></a></div><div class="test-byline-meta"><span class="test-byline-text">Contributed by <a href="/contributors/soulemike">Michael Soule</a></span><a class="test-byline-link" href="/contributors">All contributors →</a></div></div>

<p class="test-part">Part of <a href="/docs/tests/ad">Active Directory</a> · Active Directory · Organizational units · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-OU-02
```

## Overview

- The structure of Organizational Units at the domain root level reveals important information about your Active Directory organization and management approach.
- Directory hierarchy: A large number of root-level OUs may indicate a flat structure that lacks organizational depth
- Management complexity: Many root-level OUs can make the directory harder to navigate and manage
- Delegation planning: Understanding root-level OUs helps with planning administrative delegation boundaries
- Organizational alignment: The OU structure should reflect your organization's logical structure
- A well-designed OU hierarchy typically has fewer root-level OUs with meaningful nested structures beneath them, rather than many OUs all at the root level.

#### Control Type

**Operational**

#### Security Recommendation

- Consider implementing a hierarchical OU structure that:
  - Minimizes the number of OUs at the domain root (typically 5-10 major containers)
  - Groups related OUs under parent containers (e.g., by geography, department, or function)
  - Makes the directory easier to navigate and manage
  - Supports your Group Policy and delegation strategy

#### How the Test Works

- This test retrieves all Organizational Units from Active Directory and:
  - Identifies the domain's distinguished name
  - Counts OUs that are direct children of the domain root
  - Lists all root-level OUs with their distinguished names

#### Related Tests

- `Test-MtAdOuOverlappingNameCount` - Identifies OUs with duplicate names
- `Test-MtAdOuEmptyCount` - Finds OUs that contain no objects

## Details

<details>
<summary>Every attribute of this check</summary>

| Field | Value |
| --- | --- |
| Test ID | AD-OU-02 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Organizational units |
| Area | Infrastructure hardening |
| Resource type | OrganizationalUnit |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdOuAtDomainRootCount](https://github.com/maester365/maester/blob/main/tests/ad/ou/Test.AD-OU-02.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:domainDNS.distinguishedName:ReadProperty, ActiveDirectory:Ldap:organizationalUnit:ReadProperty |

</details>

## Source

- Test: [`tests/ad/ou/Test.AD-OU-02.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/ou/Test.AD-OU-02.ps1)
- Documentation: [`tests/ad/ou/Test.AD-OU-02.md`](https://github.com/maester365/maester/blob/main/tests/ad/ou/Test.AD-OU-02.md)
