How to generate and export disabled users report
The following is a comparison between obtaining a disabled users report with Windows PowerShell and ADManager Plus.
Windows PowerShell
Steps to get disabled users report using get aduser cmdlet in 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.
- 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\DisabledUsers.csv'
# your output file
$filter = {Enabled -eq $false}
Get-ADUser -Filter $filter
| foreach {Add-Content -path
$OutFile "$($_.SamAccountName),
$($_.distinguishedName)"}
Click to copy entire script
ADManager Plus
To obtain the report,
- Select Disabled Users from User reports section.
- Select domain and OU. Click Generate.
- Select Export as and choose from the drop-down list to obtain the report in the preferred format (CSV, PDF, HTML, CSVDE and XLSX).
Screenshot
» Start 30-day Free Trial
Following are the limitations to obtain report of disabled user accounts using native tools like Windows PowerShell:
- We can run this script only from the computers which has Active Directory Domain Services role.
- Adding even minor details to the report—such as adding additional attributes—require scripts to be modified and executed again, which is time-consuming.
- Exporting a report in a specific format requires a script to be modified accordingly, which increases the complexity of the scripts.
Troubleshooting is not easy in case of errors.
ADManager Plus has incorporated 'Disabled Users' feature in the User Reports for easy access to this report.