AntiMalware Status

Get Account list with Password Never Expire from Active Directory to CSV file

Quick PowerShell snippet to pull all accounts from Active Directory with PASSWORD NEVER EXPIRE into CSV report file so you can review the accounts and possible make changes as you need to.

Import-Module ActiveDirectory
#Search for the users and export report
get-aduser -filter * -properties Name, PasswordNeverExpires | where {
$_.passwordNeverExpires -eq "true" } |  Select-Object SamAccountName,Name,Enabled |
Export-csv c:\Reports\pw_never_expires.csv -NoTypeInformation

This will create a csv file under C:\Reports\ with name pw_never_expires.csv where you will find all those accounts listed that have set Password Never Expire in Active Directoryand those accounts are active.

Leave a Reply