# Groups with manager count should be retrievable

The ManagedBy attribute in Active Directory specifies who is responsible for managing a group. Assigning managers to groups provides several benefits:

Source: https://maester.dev/docs/tests/AD-GRP-04

<!-- 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 · Groups · <a href="/docs/tests">All checks</a></p>

```powershell title="Run this check"
Invoke-Maester -TestId AD-GRP-04
```

## Overview

The ManagedBy attribute in Active Directory specifies who is responsible for managing a group. Assigning managers to groups provides several benefits:

- **Accountability**: Clear ownership for group membership decisions
- **Delegation**: Allows non-administrators to manage specific groups
- **Lifecycle management**: Facilitates regular review and cleanup
- **Audit trail**: Helps trace who authorized group changes
- **Self-service**: Enables business owners to manage their own access groups

However, not all groups need managers. Built-in groups, system groups, and highly privileged groups (like Domain Admins) should typically be managed only by IT administrators.

#### Control Type

**Operational**

#### Security Recommendation

- Assign managers to business-purpose groups (department groups, project teams, etc.)
- Ensure managers understand their responsibilities for group membership review
- Implement a process for managers to regularly attest to group membership accuracy
- Do not assign managers to highly privileged groups that require IT-only management
- Consider using group expiration policies managed by group owners

#### How the Test Works

This test retrieves all group objects from Active Directory and:
- Checks the ManagedBy attribute for each group
- Counts groups where ManagedBy is populated (not null or empty)
- Calculates the percentage of managed vs. unmanaged groups

#### Related Tests

- `Test-MtAdGroupStaleCount` - Groups with managers should be reviewed regularly to prevent staleness
- `Test-MtAdGroupInContainerCount` - Groups with managers should typically be organized in appropriate OUs

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-GRP-04 |
| Severity | Info |
| Suite | Active Directory |
| Product | Active Directory |
| Feature | Groups |
| Area | Identity lifecycle and hygiene |
| Resource type | Group |
| MITRE ATT&CK | None |
| PowerShell test | [Test-MtAdGroupWithManagerCount](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GRP-04.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:group:ReadProperty |

</details>

## Source

- Test: [`tests/ad/group/Test.AD-GRP-04.ps1`](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GRP-04.ps1)
- Documentation: [`tests/ad/group/Test.AD-GRP-04.md`](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GRP-04.md)
