How to generate and export specific users report

The following is a comparison between obtaining a report on specific users with Windows PowerShell and ADManager Plus.

Windows PowerShell

Steps to obtain specific Active Directory users report using PowerShell:

  • Identify the domain from which you want to retrieve the report.
  • Identify the LDAP attributes you need to fetch the report.
  • Identify the primary DC to retrieve the report.
  • Compile the script.
  • The script should contain filters for users by OU(s) and Domain(s) and most importantly SAMAccount Name. 
  • Execute it in Windows PowerShell.
  • The report will be exported in the given format.
  • To obtain the report in a different format, modify the script accordingly to the needs of the user.

Sample Windows Powershell Script

 Copied
import-module activedirectory
$OutFile = 'C:\Scripts\SpecificUsers.csv'
# your output file
$MyOU = 'OU=andrea,DC=mse1,DC=com' # DN
Get-ADUser -SearchBase
$MyOU -LdapFilter 
"(&(objectClass=person)
(objectCategory=user)
(sAMAccountName=a*))" 
| foreach {Add-Content -path $OutFile 
"$($_.SamAccountName),$($_.objectGUID)"
Click to copy entire script

ADManager Plus

To obtain the report,

  • Select All Users from User reports tab. 
  • Select the domain and OU.
  • Select Export as to export the report in any of the preferred formats (CSV, PDF, HTML, CSVDE and XLSX).

Screenshot

A screenshot of ADManager Plus with users from a specific OU in a domain
 

» Start 30-day Free Trial

Following are the limitations to obtain report of specific users using native tools like Windows PowerShell:

  • We should know the exact OU path to apply OU filter. 
  • Applying filters for multiple OUs is error-prone.
  • We should run this script only from the computers which has Active Directory domain Services role.
  • Difficult to export in other formats.

With ADManager Plus, we can search for specific users with the help of the attributes such samAccountName, Display Name, Distinguished Name and Email  Address  and export them in the desired format.

Email Download Link