How to Set Office 365 Users Password Expiration Policy to Never Expire with PowerShell

ITPro Today

October 12, 2017

1 Min Read
Microsoft Office 365 logo

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

 

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like