Office 365 – Set Password to Never Expire

We recently migrated a clients in-house Exchange mail server to Microsoft Office 365 hosted by Telstra. Overall we found Office 365 to not be as straightforward and definitely not as cheap as Google Apps. The client however was quite use to their Exchange environment and were happy to pay a premium VS Google Apps.

The client wanted to configure their Office 365 password to never expire. Unfortunately, this could not be simple configured through the Microsoft Online Portal. It required configuring through the PowerShell command line. Here’s the steps to do it:

 

Step 1 – Download & Install Microsoft Online Services Module for Windows PowerShell
This can be download here.

 

Step 2 – Run Microsoft Online Services Module for Windows PowerShell

 

Step 3 – To connect to your Office 365 service, run this command:

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection

 

Step 4 – Enter your Office 365 administrator username and password in the dialogue box that appears.

 

Step 5 – Connect to the MSOL Service by running this command:

Connect-MsolService

 

Step 6 – Set the password to never expire for all users:

C:\Users\Ryan\Desktop> Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

 

Step 7 – Confirm that password is set to NEVER expire for all users:

C:\Users\Ryan\Desktop> Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

This should display something like:

UserPrincipalName                                         PasswordNeverExpires
—————–                                                             ——————–
peter.johnson@somedomain.com.au        True
admin@somedomain.onmicrosoft.com   True
maria.smith@somedomain.com.au           True
admin@somedomain.com.au                      True

Share your thoughts