Configure user passwords to never expire
Published: April 16, 2012
Updated: February 28, 2013
Applies To: Office 365, Windows Intune
Note |
|---|
| This topic provides online help content that is applicable to multiple Microsoft cloud services, including Windows Intune and Office 365. |
As a global administrator for a Microsoft cloud service, you can use the Windows Azure Active Directory Module for Windows PowerShell to set up user passwords to never expire. You can also use Windows PowerShell cmdlets to remove the never-expires configuration, or to see which user passwords are set up to never expire.
Note |
|---|
| Only passwords for user accounts that are not synchronized through directory synchronization can be configured to never expire. For more information about directory synchronization, see the list of topics in Directory synchronization roadmap. |
To use Windows PowerShell cmdlets, you first must install them.
What do you want to do?
Find out whether a password is set to never expire
-
Connect to Windows PowerShell using your company administrator credentials.
-
Do one of the following:
-
To see whether a single user’s password is set to never expire, run the following cmdlet by using the user principal name (UPN) (for example, aprilr@contoso.onmicrosoft.com) or the user ID of the user you want to check:
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires -
To see the "Password never expires" setting for all users, run the following cmdlet:
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires
-
To see whether a single user’s password is set to never expire, run the following cmdlet by using the user principal name (UPN) (for example, aprilr@contoso.onmicrosoft.com) or the user ID of the user you want to check:
Set a password to never expire
-
Connect to Windows PowerShell using your company administrator credentials.
-
Do one of the following:
-
To set the password of one user to never expire, run the following cmdlet by using the user principal name (UPN) or the user ID of the user:
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true -
To set the passwords of all the users in an organization to never expire, run the following cmdlet:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
-
To set the password of one user to never expire, run the following cmdlet by using the user principal name (UPN) or the user ID of the user:
Set a password to expire
-
Connect to Windows PowerShell using your company administrator credentials.
-
Do one of the following:
-
To set the password of one user so that the password does expire, run the following cmdlet by using the user principal name (UPN) or the user ID of the user:
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $false -
To set the passwords of all users in the organization so that they do expire, use the following cmdlet:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false
-
To set the password of one user so that the password does expire, run the following cmdlet by using the user principal name (UPN) or the user ID of the user:
See Also

Note