Blog Archive

SharePoint-courses
Iván Paredes

Office 365: How to disable Password Expiration Policy

2011-10-04 13:24:00 by Iván Paredes

Some of our clients sometimes need to disable their PassWord Expiration Policy. You may find yourself in the same situation. To disable this, just follow these simple steps:

 

Step 0 – Download and install the Microsoft Online Services Module and execute it: http://onlinehelp.microsoft.com/en-us/office365-enterprises/ff652560.aspx#BKMK_DownloadTheMOSIdentityFederationTool

 

Step 1 – Creates a PSCredential object using your Office 365 administrator user name and password.

$cred = get-credential

Creates a PSCredential object using your Office 365 administrator user name and password

The command will prompt for your credentials. Type them in:

Type your credentials

 

Step 2 – Initiate a connection to Office 365:

Connect-MsolService –Credential $cred

Initiate a connection to Office 365

 

Step 3 - Retrieves the user from the Office 365 directory:

$user = Get-MsolUser –UserPrincipalName user@domain.com

Retrieves the user from the Office 365 directory

 

Step 4 – Updates the user property “PasswordNeverExpires” in the Office 365 directory:

Set-MsolUser –UserPrincipalName &user.UserPrincipalName –PasswordNeverExpires $true

Updates the user property “PasswordNeverExpires” in the Office 365 directory

 

If you need to set this property for all users in Office 365 directory, follow steps 1 and 2 and then run the following commands:

Retrieve all users in the Office 365 directory:

$users = Get-MsolUser

Retrieve all users in the Office 365 directory

 

Updates the property “PasswordNeverExpires” for all users in Office 365 directory:

foreach ($user in $users) {

Set-MsolUser –UserPrincipalName $user.UserPrincipalName –PasswordNeverExpires $true }

Updates the property “PasswordNeverExpires” for all users in Office 365 directory

 

Remember that this only applies when we have not deployed Active Directory Federation Services. In that case it is our local Active Directory who is responsible for establishing this security policy.

Regards!

Comments

#re: Office 365: How to disable Password Expiration Policy
Tuesday, November 29, 2011 - 04:09 PM by Eric
Do you know how to check the expiration date of passwords? I have tried this but it does not return anything for the date column: get-msoluser | select displayname, passwordexpirationdate Thank you!
Leave a Comment
(*) Title:
(*) Name:
Your URL:
(*) Comments:
Follow us on: