# Dormant enabled user count should be retrievable

Enabled user accounts that have not logged on for more than the configured threshold (default 90 days) are a common sign of weak identity hygiene.

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

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

## Overview

Enabled user accounts that have not logged on for more than the configured threshold (default 90 days) are a common sign of weak identity hygiene. Forgotten but still-enabled accounts can retain access, group memberships, and password material that attackers may target.

#### Control Type

**Detective**

#### Security Recommendation

Investigate dormant enabled accounts and disable or remove those that are no longer needed. For exceptions such as break-glass or low-use service accounts, apply stronger controls and document ownership.

#### How the Test Works

This test retrieves Active Directory user data from `Get-MtADDomainState`, filters to enabled users, and counts accounts where `LastLogonDate` is older than `MaximumInactiveDays` (default 90 days). The output shows the number and percentage of dormant enabled users.

#### Related Tests

- `Test-MtAdUserDisabledCount`
- `Test-MtAdUserNeverLoggedInCount`
- `Test-MtAdUserPasswordNeverExpiresCount`

#### Related links

- [Microsoft Defender for Identity: Remove stale Active Directory accounts](https://learn.microsoft.com/defender-for-identity/security-posture-assessments/accounts#remove-stale-active-directory-accounts)
- [ANSSI Active Directory checkpoints: Dormant accounts](https://www.cert.ssi.gouv.fr/uploads/ad_checklist.html#vuln_user_accounts_dormant)

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-USER-02 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Users |
| Area | Identity lifecycle and hygiene |
| Resource type | User |
| MITRE ATT&CK | T1078.002 Domain Accounts |
| Supports controls | nist-800-53-r5:AC-2(3) |
| PowerShell test | [Test-MtAdUserDormantEnabledCount](https://github.com/maester365/maester/blob/main/tests/ad/user/Test.AD-USER-02.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:user:ReadProperty |

</details>

## Source

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