Exporting password properties from Active Directory to file with PowerShell

This command exports password information of users from Active Directory and writes them to a csv file:

Get-ADUser -Filter * -Properties SamAccountName, PasswordLastSet, PasswordNeverExpires | Select SamAccountName, PasswordLastSet, PasswordNeverExpires | Sort SamAccountName | Export-CSV -Path ("{0}\Desktop\AD.User.Password.csv" -f $env:USERPROFILE) -NoClobber -Encoding UTF8 -NoTypeInformation -Force

 

Leave a Reply

Your email address will not be published. Required fields are marked *