Set an individual user's password to never expire in O365

Modified on Wed, 7 Jun, 2017 at 8:04 PM


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

    
  1.   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.              
  2.   Open Windows Power Shell as an administrator:        
    1. In your search bar, type Windows Power Shell.                      
    2. Right-click on Windows Power Shell and select Run as Administrator.            

      Open PowerShell as "Run as administrator."

                            
  3.   The Windows PowerShell window will pop open. The prompt C:\Windows\system32 means you opened it as an administrator.        

    What PowerShell looks like when you first open it.

                  
  4.     Run the following cmdlet (we say "run the cmdlet" which means to type the following command at the PowerShell prompt):                  
    Connect-MsolService
            
                  
  5. In the Sign in to your account page that opens, enter your admin credentials to connect to the service, and click Sign in.                
  6. 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. 

                  
  7.         

    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 

    

  1. Run the following cmdlet:                  
    Connect-MsolService
            
                  
  2. In the Sign in to your account page that opens, enter your admin credentials to connect to the service, and click Sign in.  

                  
  3. 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: 

            

    This picture shows the commands to set the password to never expire, and then verify it was set.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article