O365 PowerShell: Disable individual user’s password expiry
Sometimes as an Office 365 admin, you may be in a situation where you want to set password not to expire for an Office 365 account. The below steps will guide you to set the password not to expire for individual accounts.
Before connecting to your Office 365 organization, make sure the Azure Active Directory Module for Windows PowerShell is already installed and run the following PowerShell Cmdlets.
*Connect to Msol-Service *and key in your Office 365 Tenant admin credentials.
https://sys175.files.wordpress.com/2016/09/connect_msol11.png
Upon successful authentication run the following commands.
**To set the Password Never Expires setting **
*Set-MsolUser -UserPrincipialName <useraccount@contoso.com> -PasswordNeverExpires $true *
**To remove the Password Never Expires setting **
*Set-MsolUser -UserPrincipialName <useraccount@contoso.com> -PasswordNeverExpires $false *
**To list all users whose password was set to never expire **
*Get-MsolUser | Select UserPrincipialName, PasswordNeverExpires *
Important Notes
- The user password will eventually expire after 730 days (maximum password age for non-expiring passwords).
- Only passwords of user accounts that are not synchronized through Directory Sync can be set to never expire.