Setting Office 365 User Passwords to Never Expire

The default policy for Office 365 user accounts is to automatically expire their passwords after 90 days.

Some of our users experienced this today and the most annoying thing about it was that they were not warned beforehand about it. They were simply locked out their account until they changed it there and then; unlike the Windows OS counterpart which gives you a comfortable 15 day warning before forcing you to change your password.

Anyway, this article will tell you how to set the password expiry from 90 days to never.
Office 365 already enforces a strong password policy BUT I do not recommend you change this setting if your users often use public terminals or are prone to writing their passwords on sticky notes and keeping them under their keyboards 🙂

  1. First you need to download the AdministrationConfig.msi from Microsoft. This is not the same as PowerShell. The MSO config shell is used mainly for administrative purposes. You can download it here.
  2. Enter the commands below:Import-Module MSOnline
    $Creds = Get-Credential
    Connect-MsolService –Credential $Creds
    $LiveCred = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange-ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    Get-MSOLUser | Set-MSOLUser –PasswordNeverExpires $true

The last command is the one which sets the ‘PasswordNeverExpires’ attribute to true for all your users.

2 thoughts on “Setting Office 365 User Passwords to Never Expire”

    1. Good question – from the command structure it looks like only the users in the list (Get-MSOLUser) will be affected.
      There may be a way to set this to $false globally but I haven’t seen how.

Comments are closed.