Set an individual user's password to never expire
If you have company requirements to set some individual user passwords to never expire, you need to use Windows Power-shell. You can't do this in the Office 365 admin center.
If you're new to Windows Power-shell, you can do this! The Power-shell commands used in this article will only change a person's password expiration.Set a user's password to never expire
- If you haven't yet installed the Microsoft Online Services Sign-in Assistant and the Windows Azure Active Directory Module for Windows Power Shell, do that first. For a link to the downloads and instructions, see Step 1: Install the required software in the article Connect to Office 365 PowerShell.
- Open Windows Power Shell as an administrator:
- In your search bar, type Windows Power Shell.
- Right-click on Windows Power Shell and select Run as Administrator.
- The Windows PowerShell window will pop open. The prompt C:\Windows\system32 means you opened it as an administrator.
- Run the following cmdlet (we say "run the cmdlet" which means to type the following command at the PowerShell prompt):
Connect-MsolService
- In the Sign in to your account page that opens, enter your admin credentials to connect to the service, and click Sign in.
- Run the following cmdlet to set the password of one user to never expire:
Set-MsolUser -UserPrincipalName <name of the account> -PasswordNeverExpires $true
For example, if the name of the account is Ina@contoso.com, you'd type the command like this:
Set-MsolUser -UserPrincipalName Ina@contoso.com -PasswordNeverExpires $true
If you get a red error message, there's probably a typo or an extra space. Try again! Or, copy and past the above to the PowerShell prompt, and use the arrow key to erase <name of the account> and enter the real name of the account.
-
When you're successful, the PowerShell prompt appears for the next command. It doesn't display anything like "done" or "success."
Find out whether a user's password is set to never expire
- Run the following cmdlet:
Connect-MsolService
-
In the Sign in to your account page that opens, enter your admin credentials to connect to the service, and click Sign in.
-
Run the following cmdlet:
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires
For example, to see the status for Ina@contoso.com, you'd type the following:
Get-MSOLUser -UserPrincipalName Ina@contoso.com | Select PasswordNeverExpires
The following picture shows how I set the password to never expire, and then ran the command to verify it is now set to never expire: