Turn off password expiration for domain in Office365

For users who are not synchronized through directory synchronization

In Office 365, customers can use the Microsoft Online Services Module for Windows PowerShell (MOSMWP) to configure their user passwords to never expire. The following steps can be provided to customers who want to configure these settings for their users.

Get-ExecutionPolicy

If set to unrestricted continue, if not use the command

Set-ExecutionPolicy (hit enter), then type unrestricted.

$LiveCred = Get-Credential

Put in the specific domain admin id and password.

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

This connects up to MS online portal and allows for importing of session with scripts to allow for change.

Import-PSSession $Session

Imports session with scripts (temporarily)

Connect-Msolservice

This will ask again for domain id and PW.

Get-MsolUser | Set-MsolUser -PasswordNeverExpires $true

This puts policy in place for all users.

Get-MsolUser | Select UserPrincipalName, PasswordNeverExpires

This shows if script has worked. All should be set to true after change is made.

Note If you want to change the setting back (and allow for password expiration) for all the users in an organization, use the following cmdlet:

Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $false

For more information about the Microsoft Online Services Module for Windows PowerShell, visit the following Microsoft website:

http://onlinehelp.microsoft.com/en-us/office365-enterprises/hh125001.aspx

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s