Microsoft Office 365 – Configure a User Password to Never Expire

This article will show you how to configure a user password to never expire on the Office 365 platform.

Install the PowerShell cmdlets for Office 365

First you will need the PowerShell cmdlets installed onto your computer. To install them, please follow the instructions here:
http://onlinehelp.microsoft.com/en-us/office365-enterprises/2b09b6a8-ad7e-446f-b7f0-273856beed70#BKMK_install

Set Windows Powershell Credentials

media_1356721274271.png

To connect Windows Powershell to Office 365, run the following cmdlet from the Powershell window (which you installed in the above step).

$cred=Get-Credential
After running that command, you will get a login window. Type in an “admin” level user for Office 365 (in the format of username@domain.com) and select “Ok”.

Connect Windows Powershell to Office 365

media_1356721338308.png

Next, run the following cmdlet:
connect-MSOLService -credential $cred
If it connects successfully, no messages will be should be shown, just a new line as shown in the above screenshot.

If You Get an Error . . .

media_1356721102963.png

If the credentials you’ve provided are incorrect, you will get a screen like the one above. If this happens, check your credentials and re-run the cmdlets above.

Find Out Whether a Password is Set to Never Expire

media_1356721636537.png

To see whether a single user’s password is set to never expire, run the following cmdlet by using the user ID (in the format of username@domain.com) of the user you want to check:
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires

The result of the cmdlet will show if this flag has been set or not for this user. An example of this can be seen in the above screenshot. For this particular user, it has not been set.

Optional — To see the “Password never expires” setting for all users, run the following cmdlet:
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires

Set a Password to Never Expire

media_1356721960266.png

To set the password of one user to never expire, run the following cmdlet by using the user ID of the user (in the format of username@domain.com):
Set-MsolUser -UserPrincipalName <user ID> -PasswordNeverExpires $true

Optional — To set the passwords of all the users in an organization to never expire, run the following cmdlet:
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

Set a Password to Expire (To Undo Above)

To set the password of one user so that the password does expire, run the following cmdlet by using 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

Advertisements