PowerShell | Get-ADOrganizationalUnit
<#
Summary:
Get list of OU's one level down from declared parent
Loop through items in Var
Get list of users in each OU, Select Name,Enabled
Export Group results of each OU to unique file
Note: Might want to add -Recursive if there are more sub OU's
Author: Scott Head
Date: 05/09/2022
Version: 1.0
#>
$OUINFO=Get-ADOrganizationalUnit -LDAPFilter '(name=*)' -SearchBase 'OU=Employees,OU=Accounts,DC=YourDomain,DC=net' -SearchScope OneLevel | Select Name,DistinguishedName | Export-csv C:\temp\OU-List.csv -NoTypeInformation
Foreach($OU in $OUINFO){
Get-ADUser -Properties * -SearchBase $ou.DistinguishedName -Filter {(Enabled -eq $True)} | Select Name,enabled | Export-csv C:\temp\$($OU.Name).csv -NoTypeInformation
}