Skip to content

Audit Active Directory Privileged Group Membership

Admin
October 4, 2026
7 min read
Intermediate
💻 Target OS: Windows Server 2025 / Windows 11

Before you begin

  • Applies to:Read-only review of selected privileged groups across one Active Directory forest.
  • Where to start:Open PowerShell with the Active Directory module on an approved administration workstation.
  • What you need:Have read access in every included domain, connectivity to their AD Web Services, and a protected location for the export.
Guide tools
Guide tools
0/0 Steps (0%)

Privileged groups grant broad control over domain identities, systems, and policy. A periodic membership review helps identify stale access, unexpected nested groups, and accounts that need owner confirmation.

This walkthrough reads every domain in one AD forest and exports a dated snapshot of direct membership in each domain’s Domain Admins and Builtin Administrators groups, plus the forest-root Enterprise Admins and Schema Admins groups. Run it from an approved administrative workstation with the Active Directory PowerShell module, network access to each domain’s AD Web Services, and read permissions in every domain. It does not include local machine administrators or Microsoft Entra roles.


01

Check the Read-Only Audit Context

Audit Setup

Load the Active Directory module and list the forest root and all domains in scope. Keep this PowerShell session open because the following steps reuse its forest, group, and report variables. The script queries each domain explicitly; access failures stop the audit and must be resolved before treating the export as forest-wide.

Terminal window
Import-Module ActiveDirectory -ErrorAction Stop
$forest = Get-ADForest -ErrorAction Stop
$forest | Select-Object RootDomain, Domains
$domains = foreach ($dnsName in $forest.Domains) {
Get-ADDomain -Identity $dnsName -ErrorAction Stop
}
$domains | Select-Object DNSRoot, DistinguishedName, PDCEmulator
❯ Illustrative Output (Results Vary)
RootDomain : corp.example
Domains : {corp.example, emea.corp.example}
DNSRoot : corp.example
DNSRoot : emea.corp.example

02

Define the Review Set for Your Forest

Privileged Access

Use each built-in group’s well-known SID rather than its display name, which can be localized or renamed. Domain Admins exists in every domain; Enterprise Admins and Schema Admins are forest-root groups. The Builtin Administrators SID is queried separately in each domain.

Terminal window
$root = Get-ADDomain -Identity $forest.RootDomain -ErrorAction Stop
$targets = foreach ($domain in $domains) {
[pscustomobject]@{ Domain = $domain.DNSRoot; Name = 'Domain Admins'; SID = "$($domain.DomainSID.Value)-512" }
[pscustomobject]@{ Domain = $domain.DNSRoot; Name = 'Builtin Administrators'; SID = 'S-1-5-32-544' }
}
$targets += [pscustomobject]@{ Domain = $root.DNSRoot; Name = 'Enterprise Admins'; SID = "$($root.DomainSID.Value)-519" }
$targets += [pscustomobject]@{ Domain = $root.DNSRoot; Name = 'Schema Admins'; SID = "$($root.DomainSID.Value)-518" }
$groups = foreach ($target in $targets) {
try {
$group = Get-ADGroup -Identity $target.SID -Server $target.Domain -Properties Description -ErrorAction Stop
[pscustomobject]@{ Domain = $target.Domain; Name = $target.Name; Group = $group }
} catch {
throw "Could not query $($target.Name) in $($target.Domain): $($_.Exception.Message)"
}
}
$groups | Select-Object Domain, Name, @{Name='SID'; Expression={$_.Group.SID.Value}}, @{Name='Description'; Expression={$_.Group.Description}}
❯ Illustrative Output (Results Vary)
Domain Name SID Description
------ ---- --- -----------
corp.example Domain Admins S-1-5-21-...-512 ...
emea.corp.example Domain Admins S-1-5-21-...-512 ...
corp.example Enterprise Admins S-1-5-21-...-519 ...

03

Capture Member and Nested-Group Details

Evidence Snapshot

Export direct membership first so nested groups remain visible as separate review items. The domain column identifies where each group was queried. Resolve each member to capture its object class, distinguished name, and SID, then include the group identity in the same report.

Terminal window
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
$report = Join-Path $PWD "privileged-group-members-$stamp-$([guid]::NewGuid().ToString('N')).csv"
$rows = foreach ($entry in $groups) {
$members = @(Get-ADGroupMember -Identity $entry.Group -Server $entry.Domain -ErrorAction Stop)
if ($members.Count -eq 0) {
[pscustomobject]@{
Domain = $entry.Domain
GroupName = $entry.Name
GroupSID = $entry.Group.SID.Value
MemberName = '[no direct members]'
MemberType = 'NoDirectMembers'
MemberDN = $null
MemberSID = $null
}
continue
}
foreach ($member in $members) {
$memberSid = if ($member.SID) { $member.SID.Value } else { $null }
[pscustomobject]@{
Domain = $entry.Domain
GroupName = $entry.Name
GroupSID = $entry.Group.SID.Value
MemberName = $member.Name
MemberType = $member.objectClass
MemberDN = $member.DistinguishedName
MemberSID = $memberSid
}
}
}
$rows | Sort-Object Domain, GroupName, MemberName |
Export-Csv -NoTypeInformation -Encoding UTF8 -NoClobber -ErrorAction Stop -Path $report
$report
❯ Illustrative Output (Results Vary)
D:\Audit\privileged-group-members-20261004-101500-71e85e84742b4c14a03097e2b7a41f61.csv

04

Assign Owners to Access Decisions

Review

Have the relevant service or directory owners confirm each member’s purpose and approval. Check nested groups recursively as a separate analysis so the report preserves both direct assignments and their effective membership paths. Resolve any query error from Step 2 and rerun the audit before reviewing the export; a failed query stops report generation rather than producing a partial forest result.

Terminal window
$reportRows = @(Import-Csv -LiteralPath $report -ErrorAction Stop)
$reportRows | Group-Object Domain, GroupName | ForEach-Object {
[pscustomobject]@{
Group = $_.Name
DirectMemberCount = @($_.Group | Where-Object MemberSID).Count
}
}
Get-FileHash -LiteralPath $report -Algorithm SHA256 -ErrorAction Stop
❯ Illustrative Output (Results Vary)
Group DirectMemberCount
----- ------------------
corp.example, Domain Admins 12
corp.example, Builtin Administrators 0
corp.example, Enterprise Admins 3
Algorithm : SHA256
Hash : ...

Comments