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: Click on User Reports -> Password Recently Changed

Select the Time Range for example last 90 days.

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.

Click here to 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.

Get Password Last Change Date for a Single User

Use the command below to get the password last set date for a single user.

Get-ADUser -identity robert.allen  -properties PwdLastSet  | sort Name | ft Name,@{Name='PwdLastSet';Expression={[DateTime]::FromFileTime($_.PwdLastSet)}}

You Might Also Like:

5 thoughts on “Find AD Users Last Password Change Date”

  1. Instead of the export-csv, you can just pipe the output, to a text file, by using “>”path and filename””

    ex:
    Get-ADUser -filter * -properties PwdLastSet | sort Name | ft name,@{Name=’PwdLastSet’;Expression={[DateTime]::FromFileTime($_.PwdLastSet)}} >c:\temp\lastpwchg.cfg

    Reply

Leave a Comment