# OU stale count should be retrievable

This test identifies OUs that have not been modified since before 2020, which may indicate stale or unused organizational units.

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

<!-- 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-03
```

## Overview

- Organizational Units that haven't been modified since before 2020 may represent:
- Abandoned projects: OUs created for initiatives that were never completed or were abandoned
- Outdated structure: Organizational units that no longer reflect current business structure
- Directory clutter: Unused containers that make the directory harder to navigate
- Potential security gaps: Stale OUs may have outdated permissions or Group Policy links
- While stale OUs don't pose a direct security threat, they contribute to directory sprawl and can make administration more complex. They may also retain old permissions or Group Policy settings that are no longer appropriate.

#### Control Type

**Detective**

#### Security Recommendation
- Regularly review OUs that haven't been modified in several years:
- Verify whether the OU is still needed for its original purpose
- Check if the OU contains any objects (see `Test-MtAdOuEmptyCount`)
- Review permissions and Group Policy links on stale OUs
- Consider deleting or repurposing OUs that are no longer needed
- Document the purpose of OUs to help future cleanup efforts

#### How the Test Works

- This test retrieves all Organizational Units from Active Directory and:
- Examines the last modified timestamp of each OU
- Counts OUs that haven't been modified since before January 1, 2020
- Lists stale OUs with their last modification date and distinguished name

#### Related Tests
- `Test-MtAdOuEmptyCount` - Identifies OUs with no objects
- `Test-MtAdOuEmptyDetails` - Provides detailed list of empty OUs
- `Test-MtAdGroupStaleCount` - Identifies groups not modified since before 2020

## Details

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

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

</details>

## Source

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