Use the Microsoft Online Services Module for Windows PowerShell to set up and remove the user password expire option.
Only passwords for user accounts that are not synchronized through directory synchronization can be configured to never expire.
Use Windows PowerShell to Manage Office 365. Make sure that you are using the PowerShell version that you downloaded from the download site in the Admin Portal.
- Right click the shortcut to ‘Microsoft Online Services Module for Windows PowerShell’ from the desktop and select “Run as Administrator…”
- Set the Execution Policy for the local server to Remote Signed
- Set-ExecutionPolicy –ExecutionPolicy RemoteSigned
- Set your credential Variable
- Enter the Username and password for the global admin account on Office 365 when prompted
- Connect to Microsoft Online Services with the credential variable set previously
- Connect-MsolService – Credential $cred
Check to see if a user’s password is set to never expire
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires
Check to password is set to never expire for all users
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires
Set a password to never expire for a user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true
Set a password to never expire for all users
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
Set a password to expire for a user
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $false
Set a password to expire for all users
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false
Thanks for visiting and reading my posts. I am always looking for more ideas. Please comment or email me with what you would like to see.
Office 365 MVP