How to Set Office 365 Users Password Expiration Policy to Never Expire with PowerShellHow to Set Office 365 Users Password Expiration Policy to Never Expire with PowerShell
October 12, 2017
![Microsoft Office 365 logo Microsoft Office 365 logo](https://eu-images.contentstack.com/v3/assets/blt07f68461ccd75245/blt6be989a7156de2ca/662773caabc9db6e7dbcb263/office365logored_4.jpg?width=1280&auto=webp&quality=95&format=jpg&disable=upscale)
By default, Office 365 users password are expired after 730 days. However, you can change the settings from Security & privacy tab in admin center.
This article is written to help you set Office 365 users password to never expire with the help of PowerShell.
Prerequisites
Download and install the following PowerShell modules on your machine.
Step-By-Step
1. Open PowerShell with elevated privileges and execute the following command to connect to office 365 subscription.
Connect-MsolService
When you are prompted, provide a global administrator account username and password.
2. When you are successfully connected, issue the following command to set all users password expiration policy to never expire.
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
3. To verify, issue the following command on PowerShell.
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires
About the Author
You May Also Like