How to List all users and date of last Password Change in Office 365

Posted on Posted in Office 365

The best and the easiest way to find out when the users last changed their passwords in Office 365 is using PowerShell.

First you will need to connect Windows Azure Active Directory using PowerShell and then run below cmdlet:

PS C:\> Get-MsolUser -All | select DisplayName, LastPasswordChangeTimeStamp

To export this data in CSV file use the below cmdlet:

Get-MsolUser -All | select DisplayName, LastPasswordChangeTimeStamp | Export-CSV LastPasswordChange.csv -NoTypeInformation

Check this cmdlet too: Get-MsolUser -userprincipalname user@domain.org | select DisplayName, LastPasswordChangeTimeStamp,@{Name=”PasswordAge”;Expression={(Get-Date)-$_.LastPasswordChangeTimeStamp}}

 

The outcome of above cmdlet looks like this date and time format will match your computer’s:

DisplayName    LastPasswordChangeTimestamp PasswordAge———–    ————————— ———–
User, Name       04-Oct-17 10:30p                              40.20:30:10.5012345

If you want to see all users whose passwords are older than 30 days, use this.

Get-MsolUser -All | select DisplayName, LastPasswordChangeTimeStamp,@{Name=”PasswordAge”;Expression={(Get-Date)-$_.LastPasswordChangeTimeStamp}} | where {$_.PasswordAge -gt “30”} | sort-object PasswordAge -descending

 

The above cmdlet will list all of the users with passwords older than 30 days and sort the list by the password age.

Use above method to list all users and date of last Password Change in Office 365.

Leave a Reply

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