How can I see users' Office 365 Password date (date last changed, date it will expire, etc.)?

36,776

Solution 1

I think I have it, or at least I have enough to figure out what I need.

Get-MsolUser -userprincipalname [email protected] | select DisplayName, LastPasswordChangeTimeStamp,@{Name=”PasswordAge”;Expression={(Get-Date)-$_.LastPasswordChangeTimeStamp}}

The result looks like this (date and time format will match your computer's):

DisplayName    LastPasswordChangeTimestamp PasswordAge
-----------    --------------------------- ----------- 
User, Name     09-Mar-16 5:48p             42.22:34:10.6964630

.

In order 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

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

I hope this helps others as well.

Solution 2

Thought of sharing this here.

This script generates 7 different Office 365 password reports.

https://o365reports.com/2020/02/17/export-office-365-users-last-password-change-date-to-csv/

Using this script, you can generate following password reports.

  • Pwd Expiry Date Report
    • Pwd Last Change Date Report
    • Pwd Expired Users Report
    • Pwd Never Expires Users Report
    • Soon-to-Expire Pwd Users Report
    • Recently Pwd Changed Users Report
    • Password Report for Licensed Users

enter image description here

Share:
36,776

Related videos on Youtube

Jono
Author by

Jono

Updated on September 18, 2022

Comments

  • Jono
    Jono over 1 year

    I know I can see the password dates (date last changed, date it will expire, etc.) for our in-house Active Directory. How do I see this information for Office 365 accounts, either with PowerShell or in any other way? This information is very handy to have at times. I especially need to see when people's passwords were changed.

    Thanks, Jono

  • Vomit IT - Chunky Mess Style
    Vomit IT - Chunky Mess Style over 6 years
    What's so different about this answer that's not already mentioned in the other answer again? Also, if you determine this is indeed not a duplicated answer then consider clarifying and add a little more context to this answer to convey what you are suggesting exactly and why it works, etc. You know, consider adding some reference to this answer supporting what you state and why it is.
  • Jono
    Jono over 6 years
    I see the difference. A more accurate list will result by doing the calculation against UTC since that's the dates and times that PS uses. Without the added expression, there would be a few hours difference as it calculated against the computer time instead of UTC. Is that correct @Toby?