- Open the Powershell ISE → Run the following script, adjusting the OU and export paths:
$OUpath = 'ou=Managers,dc=enterprise,dc=com'
$ExportPath = 'c:\data\users_in_ou1.csv'
Get-ADUser -Filter * -SearchBase $OUpath | Select-object
DistinguishedName,Name,UserPrincipalName | Export-Csv -NoType $ExportPath
- Open the file produced by the script in MS Excel.
![List of All Users in an OU report produced by the script in MS Excel](https://img.netwrix.com/howtos/users_in_ou.png)
- Run Netwrix Auditor → Navigate to "Reports" → Expand the "Active Directory" section → Go to "Active Directory - State-in-Time" → Select "User Accounts" → Click "View".
- Specify the "Path" filter (e.g., "%Managers%" for the "Managers" organizational unit → Click "View Report".
- To save the report, click the "Export" button → Choose a format from the dropdown menu → Click "Save".
![Netwrix Auditor User Accounts Report: shows user accounts with the path, logon name, status and last logon time](https://img.netwrix.com/howtos/User-Accounts.png)