How to set users’ passwords to never expire in Office365

Problem: How to set users’ passwords to never expire in Office365

Solution: Use powershell scripts to change Office365 Active Directory entries. See steps below:

1) If you are not using Windows 8.1 then Go to http://technet.microsoft.com/library/jj151815.aspx and click on the link install Microsoft Online Services Sign-In Assistant for IT Professionals RTW, then on the same webpage click on the link to install the Windows Azure Active Directory Module (select 32-bit or 64-bit depending on your O/S)

2) On Windows 8.1 run Powershell as Administrator or on your PC launch Windows Azure Active Directory Module for Windows Powershell – ensure you select “run as Adminstrator”. When the powershell command window opens enter the following commands:

Set-ExecutionPolicy RemoteSigned

$LiveCred = Get-Credential

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

Import-PSSession $Session

import-module MSOnline

Connect-MsolService -Credential $LiveCred

The command to set all users passwords to never expire is:

Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

If you want to check it’s worked ok the command is:

Get-MsolUser | Format-Table UserPrincipalName,DisplayName,PasswordNeverExpires


No Comments Yet.

Leave a Comment