PHPKB Knowledge Base Software Logo  
Guru Corner
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home
Home > All Categories > Microsoft > Exchange > Office 365 > Managing Password Policies in Office 365 via PowerShell
Question Title Managing Password Policies in Office 365 via PowerShell

In order to connect to the Microsoft Online Service via PowerShell, you will need to install the Microsoft Online Services Sign-In Assistant as well as the Microsoft Online Services Module for Windows PowerShell.

Once installed, launch the PowerShell interface from the Microsoft Online Services folder in the Programs menu.

Enter your Office 365 credentials:

$LiveCred = GetCredential

Connect to the Office Online service:

Connect-MSOLservice -Credential $LiveCred

To set a password never expires policy for a single user, use the following command:

Set-Msoluser -UserPrincipalName -PasswordNeverExpires $true

To set a password never expires policy for all users in a domain, use:

Get-MsolUser | Set-MsolUser -PasswordNeverExpires $true

To see which users in a domain have the password never expires value enabled, use:

Get-MsolUser | Select UserPrincipalName, PasswordNeverExpires

To manage emailed password expiration notifications, use:

Set-MsolPasswordPolicy -DomainName -NotificationDays 10 -ValidityPeriod 180

To create a new password for a user, use:

Set-MsolUserPassword -UserPrincipalName -NewPassword Password1 -ForceChangePassword $false

To block a user account, use:

Set-MsolUser -UserPrincipalName -blockcredential $true
Authored by: Guru Corner
Click Here to View all the questions in Office 365 category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
Article Information Additional Information
Article Number: 300
Created: 2013-07-07 7:37 PM
Rating: No Rating
Article Options Article Options
Print Question Print this Question
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Search Knowledge Base Search Knowledge Base

Powered by Guru Corner