Disable Expiration of Office 365 Account Password

You might have a rare situation in which you need to maintain a password for a specific Office 365 account or for all accounts.  Other than being a bad security decision and model it can be done.  However, it can only be done when connected to Office 365 via PowerShell.

In the PowerShell console, check the password status of an individual user or all users.

For individual users… Get-MsolUser -UserPrincipalName ”O365 Account UPN” | Select PasswordNeverExpires

For all users, use this command… Get-MsolUser | Select UserPrincipalName, PasswordNeverExpires

If the field for “PasswordNeverExpires” is blank (or does not have a value), the account is likely to be an object that is being synchronized from your local Active Directory.  If the “PasswordNeverExpires” field has a value of “False”, then the account password has an expiration set for it.  Our goal is to disable password expiry by setting the value to “True”.

To set the value to true, we will again show examples for an individual and all users.

For individual users… Set-MsolUser -UserPrincipalName “O365 Account UPN” -PasswordNeverExpires $true

For all users… Get-MsolUser | Set-MsolUser -PasswordNeverExpires $true

If for any reason you need to reset password expiry, change the value of the “-PasswordNeverExpires” switch in the two previous commands to “$false”.

Reference(s): Configure user passwords to never expire

Good luck.

Todd (@oddytee)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s