How to Set a User’s Password to Never Expire Office 365

In this article, I’ll show you how to set a user’s account password to never expire using the Office 365 PowerShell module.

In past, I’ve shown how to set the password not to expire using the new Office 365 PowerShell module (also known as V2).

However, currently, most organizations are using version 1 of the module because V2 is not fully functional and doesn’t contain all the Office 365 cmdlet.

Connect to Office 365

Before we can set the password to never expire, we need to log into Office 365 using PowerShell.

Make sure you are login with an Administrator account using the cmdlet below.

Connect-msolnline

Once connected, I’ll use the cmdlet below to set an account called Admin to have is password never expire.

Set-MsolUser -UserPrincipalName admin@name.onmicrosoft.com -PasswordNeverExpires $true

To check if the cmdlet worked the password never expire option is enabled I’ll use the cmdlet below.

Get-MSOLUser -UserPrincipalName name@name.onmicrosoft.com | Select PasswordNeverExpires | ft -AutoSize

Conclusion

The process to set a password to never expire is not so complicated however you must use PowerShell.

The best practice is to use this method when using service account with scripts.

Leave a Reply

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