The Admin Centres for Office 365 and for Exchange Online are great for simple and singular tasks regarding password management and policy, however, if you wish to carry wider tasks or bulk user management PowerShell is the best option. You can manage multiple domains simultaneously, or script the commands to include a CSV file of as many users as you require.
Set an Office 365 or Exchange Online user password so that it never expires
Set-MsolUser –UserPrincipalName [email protected] -PasswordNeverExpires $True
This option turns off password expiry policy so that the user password never expires.
Set an Office 365 or Exchange Online user password so that it expires
Set-MsolUser -UserPrincipalName [email protected] -PasswordNeverExpires $False
This option turns on password expiry policy so that the user password expires according to the policy.
Enable password policy in Office 365 or Exchange Online
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $False
This option turns on password policy for all users so that the user passwords never expire.
Disable password policy in Office 365 or Exchange Online
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $True
This option turns off password policy for all users so that the user passwords expire according to the policy.
Set the Office 365 or Exchange Online Password Policy
Set-MsolPasswordPolicy -DomainName serviceteamit.co.uk -NotificationDays 14 -ValidityPeriod 90
This option sets the password policy for the domain serviceteamit.co.uk to a valid password period of 90 days and notify the user 14 days prior to expiry.
Create a new password for a user in Office 365 or Exchange Online
Set-MsolUserPassword -UserPrincipalName [email protected] -NewPassword An3wPa55w0rd -ForceChangePassword $False
This option sets the password to the chosen password An3wPa55w0rd for the named user [email protected].
Create a new password for all users in Office 365 or Exchange Online
Get-MsolUser |%{Set-MsolUserPassword -UserPrincipalName $_.UserPrincipalName –NewPassword An3wPa55w0rd -ForceChangePassword $False}
This options sets the password to the chosen password An3wPa55w0rd for all users.
Set a new password for all users in Office 365 or Exchange Online with a CSV
- Create your CSV or export your user list from Office 365 or Exchange Online:
Get-MsolUser | Select -All|Export-CSV C:serviceteamitcustomersuser_export.csv
This option exports the user list in a handy CSV saving to the path C:serviceteamitcustomersuser_export.csv.
- Create unique passwords for all your users via your favourite bulk password generator.
- Import your CSV to Office 365 or Exchange Online:
Import-CSV –Path C:serviceteamitcustomersuser_import.csv| ForEach-Object { Set-MsolUserPassword -UserPrincipalName $_.UserPrincipalName –NewPassword $_.NewPassword -ForceChangePassword $True }
This option imports the user list from the the path C:serviceteamitcustomersuser_import.csv and requires users reset their password when they first login. You can download a sample CSV file Office 365 & Exchange Online sample CSV user_import.csv.
You can find additional information regarding passwords in this post. If you have any questions or need a little more in-depth help please get in touch.
I can’t thank you enough for this.