Find AD Users Last Password Change Date

In this guide, I’ll show you two options for getting the last password change date for Active Directory users. This information is saved to the pwdLastSet attribute for each AD user account.

How to Find Last Password Change Date With PowerShell

  1. Open PowerShell ISE:

    Copy and paste the script below:

    Get-ADUser -filter *  -properties PwdLastSet  | sort Name | ft Name,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}}
  2. Review Results:

    Output will be displayed in the powershell console.

  3. Export to CSV:

    To export the results to CSV use the export-csv -path c:\pwdlastset.csv command.

Option#2 AD Pro Toolkit

Step 1: Open the Toolkit -> AD Cleanup

Select “Entire Domain”, OU or Group, or Seach for an account.

Step 2: Click “Run” and review the results.

Step 3: Click the export button to download to CSV file.

Get-ADUser PwdLastSet Details

The PwdLastSet attribute is stored as an Interger8 data type, meaning it’s not in a readable format.

The PowerShell expression below is used to convert the PwdLastSet value to a readable value.

@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}}

Here is a screenshot of the value of the PwdLastSet attribute before converting it.

Here is a screenshot after adding the expression to the PowerShell command.

The AD Pro Toolkit converts the pwdLastSet by default making it fast and easy to use.

Learn more about the AD Pro Toolkit Features or download a free trial.

Get Password Last Set Date for Users From Specific Organizational Unit (OU)

Use the -SearchBase option to specify an OU. The below example gets the password last set for all users in my Accounting OU.

Get-ADUser -SearchBase "OU=Accounting,OU=ADPRO Users,DC=ad,DC=activedirectorypro,DC=com" -properties PwdLastSet  | sort Name | ft Name,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}}

With the AD Pro Toolkit just click browse and select one or multiple OUs.

Recommended Reading:

Leave a Comment