Microsoft 365 – Force password reset not working for all users

I was asked to force a password reset for all users in the tenant.
This request was easy at first but for some reason not all users were forces to change their password.

What i did was connect to Microsoft Online via PowerShell and run the following commands;
Connect-MsolService
Get an .csv file with all usernames and the date of the LastPasswordChangeTimeStamp variable, this might come in handy when troubleshooting.
Get-MsolUser -All | select DisplayName, LastPasswordChangeTimeStamp | Export-Csv C:\Temp\LastPasswordChangeTimeStamp.csv

Next i ran the below command, this should force all users to change their passwords.
Get-MsolUser -All | Set-MsolUserPassword -ForceChangePasswordOnly $true -ForceChangePassword $true

But now, for some reason it was not working for most of the users, I had to renew the RefreshToken for these users and from that moment they were getting the password change notification.
Set-MsolUser -UserPrincipalName –StsRefreshTokensValidFrom $RefreshTokensValidFrom

Let me know if this helped you!

Leave a Reply

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

Are you a human? *