# Forest domain count should be retrievable

Understanding the number and names of domains in your forest is critical for:

Source: https://maester.dev/docs/tests/AD-FOR-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 · Domain and forest · <a href="/docs/tests">All checks</a></p>

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

## Overview

Understanding the number and names of domains in your forest is critical for:

- **Security Boundaries**: Each domain represents a security boundary with its own policies
- **Trust Management**: Understanding trust relationships between domains
- **Administrative Scope**: Knowing where administrative permissions apply
- **Compliance Scope**: Determining the scope of compliance assessments
- **Disaster Recovery**: Planning recovery procedures across all domains

#### Control Type

**Operational**

#### Security Recommendation

- **Minimize Domains**: Fewer domains reduce complexity and attack surface
- **Document Structure**: Maintain documentation of all domains and their purposes
- **Review Regularly**: Periodically review if all domains are still needed
- **Consistent Policies**: Apply consistent security policies across all domains

#### How the Test Works

This test retrieves all domains from the Active Directory forest and counts them. It also lists all domain names for reference.

#### Related Tests

- `Test-MtAdForestFunctionalLevel` - Retrieves the forest functional level
- `Test-MtAdDomainControllerCount` - Counts domain controllers in the current domain

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-FOR-02 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Domain and forest |
| Area | Infrastructure hardening |
| Resource type | Tenant |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdForestDomainCount](https://github.com/maester365/maester/blob/main/tests/ad/domain/Test.AD-FOR-02.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:crossRef:ReadProperty |

</details>

## Source

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