We can find and export lockout out AD user accounts using powershell cmdlets Search-ADAccount and Export-CSV.
The following command find the locked-out users by passing the parameter LockedOut into Powershell cmdlet Search-ADAccount and list the selected properties of all locked out Active Directory users.
Import-Module ActiveDirectory Search-ADAccount –LockedOut | Select -Property Name,DistinguishedName
Export locked out AD users to CSV using Powershell
We can export powershell output into CSV file using Export-CSV cmdlet. The following command export selected properties of all locked out Active Directory user accounts to CSV file.
Import-Module ActiveDirectory Search-ADAccount –LockedOut | Select -Property Name,DistinguishedName | Export-CSV "C:\LockedOutADUsers.csv" -NoTypeInformation -Encoding UTF8
CSV Output of Locked-Out AD User Accounts:
Advertisement