Categories: Windows Server

SOLVED: PowerShell Command to Produce a List of All Disabled User Accounts in AD

Here is a useful little script to help you clean up your Active Directory. This PowerShell script outputs a .CSV file (so you can then edit and sort in Excel) which includes the User Name, Last Logon Date, Account Name, Distinguished Name, and Description.

Get-ADUser -Filter {Enabled -eq $false} -Properties Name, SamAccountName, DistinguishedName, Description, LastLogonDate | Select-Object Name, LastLogonDate, SamAccountName, DistinguishedName, Description | Export-Csv -NoTypeInformation -Path "C:\DisabledUsers.csv"

Published by
Ian Matthews

This website uses cookies.