# Computer non-standard primary group count should be retrievable

Computer accounts should use standard primary group IDs. Non-standard primary groups may indicate:

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

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

## Overview

Computer accounts should use standard primary group IDs. Non-standard primary groups may indicate:

- **Misconfiguration**: Computers accidentally assigned to incorrect groups
- **Custom security configurations**: Potential deviations from security baselines
- **Legacy issues**: Remnants of previous domain configurations or migrations
- **Privilege escalation risks**: Computers in inappropriate groups may have excessive permissions

The standard primary groups for computers are:
- **515** - Domain Computers (standard workstations and member servers)
- **516** - Domain Controllers (DC computer accounts)
- **521** - Read-only Domain Controllers (RODC computer accounts)

#### Control Type

**Detective**

#### Security Recommendation

- Review computers with non-standard primary groups to understand why they deviate
- Ensure custom primary groups are intentional and properly documented
- Verify that computers are not accidentally placed in groups that grant excessive privileges
- Consider standardizing on the default groups unless there's a specific security requirement

#### How the Test Works

This test examines the `primaryGroupId` attribute of all enabled computer accounts and identifies those where the value is not 515, 516, or 521.

#### Related Tests

- `Test-MtAdComputerSidHistoryCount` - Identifies computers with migration artifacts
- `Test-MtAdComputerOUCount` - Shows the distribution of computers across OUs

## Details

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

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

</details>

## Source

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