Given access to a Domain Controller (DC), a domain account with required permissions, and a workstation with Remote Server Administration Tools (RSAT) and PowerShell.
Operator Note: Exporting OU structure helps map the organizational design of Active Directory, identify abnormal/malicious OUs, and verify proper object placement.
All Organizational Unit (OU) information has been exported to a local file and validated for incident review.
Multiple tools can perform this task, including:
Get-ADOrganizationalUnit
)Get-ADOrganizationalUnit -Filter * | Select-Object -ExpandProperty DistinguishedName
Get-ADOrganizationalUnit -Filter 'Name -like "*"' | Format-Table Name, DistinguishedName -AutoSize
Get-ADOrganizationalUnit -Filter * | Select-Object Name, DistinguishedName | Export-Csv ".\OU_Structure.csv" -NoTypeInformation
dsquery ou DC=<DOMAIN>,DC=<DOMAIN EXTENSION>
netdom query WORKSTATION
netdom query SERVER
netdom query DC
netdom query OU
netdom query PDC
Operator Note: Netdom output can help correlate OU locations and understand domain structure relationships quickly.
ldifde -f ou_export.ldf -d "DC=contoso,DC=com" -p subtree -r "(objectClass=organizationalUnit)"
csvde -f ou_export.csv -r "(objectClass=organizationalUnit)"
Get-ADOrganizationalUnit -Filter * | Select-Object Name, DistinguishedName | Export-Csv ".\OU_Structure.csv" -NoTypeInformation
Tool | Platform | Use Case |
---|---|---|
PowerShell + AD Module | Windows | Primary export method |
dsquery | Windows | Simple OU export |
LDIFDE / CSVDE | Windows | Export to simple text formats |
Netdom | Windows | Object discovery (workstations, servers, PDC, OUs) |
ADExplorer (Sysinternals) | Windows | Visual OU mapping |
BloodHound (optional, advanced use) | Windows/Linux | Graph-based AD analysis |
Get-ADOrganizationalUnit PowerShell Cmdlet
Get-OU_Permissions
Dsquery OU command line reference
LDIFDE.EXE command line tool
CSVDE.EXE command line tool
Date | Version | Description | Author |
---|---|---|---|
2025-05-02 | 2.0 | Final version with restored manual steps, full tooling, operator checklist, and best practices | Leo |