# Distinct account types of members count should be retrievable

For performance reasons, the test analyzes members from the first 50 groups and deduplicates by SID.

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

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

## Overview

- Understanding the types of objects that can be group members helps assess Active Directory security posture:
- **Security Principal Types**: Groups can contain users, groups, computers, and foreign security principals
- **Nested Groups**: Groups containing other groups create inheritance chains that can be complex to audit
- **Computer Membership**: Computers in groups may indicate service accounts or special access requirements
- **Foreign Principals**: External domain members represent trust relationships that extend beyond the local domain

#### Control Type

**Operational**

#### Security Recommendation

- Monitor group membership composition:
- Nested group membership can create unexpected access paths
- Foreign security principals indicate cross-domain access that should be regularly reviewed
- Computer accounts in sensitive groups may indicate misconfigurations

#### How the Test Works

- This test analyzes group membership across Active Directory and:
- Identifies distinct object classes among group members
- Counts unique account types (user, group, computer, foreignSecurityPrincipal)
- Provides visibility into membership composition

For performance reasons, the test analyzes members from the first 50 groups and deduplicates by SID.

#### Related Tests

- `Test-MtAdGroupMemberAccountTypeDetails` - Detailed breakdown of account types
- `Test-MtAdGroupMemberForeignSidCount` - Identifies foreign security principals specifically

## Details

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

| Field | Value |
| --- | --- |
| Test ID | AD-GMC-02 |
| 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-MtAdGroupMemberAccountTypeCount](https://github.com/maester365/maester/blob/main/tests/ad/group/Test.AD-GMC-02.ps1) |
| Services | ActiveDirectory |
| Permissions | ActiveDirectory:Ldap:group:ReadProperty, ActiveDirectory:Ldap:group.member:ReadProperty |

</details>

## Source

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