Jump to content













Photo
- - - - -

Manage Office 365 password expiration

Posted by Pantelis Apostolidis , in Office 365 23 January 2015 · 673 views

office 365 powershell

1. Check if the password is set to never expire for one user:

 

Get-MSOLUser -UserPrincipalName username | Select PasswordNeverExpires

 

2. Check if the password is set to never expire for all users:

 

Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires

 

3. Check if the password is set to never expire for a list of users:

 

create a txt file listing the required users, line by line with title “username”, and save it as c:\pwdexpire.txt, like this:

 

username
testuser1
testuser2
testuser3

 

then run:

 

Import-csv c:\pwdexpire.txt | for each { Get-MSOLUser -UserPrincipalName $_.username | Select PasswordNeverExpires }

 

4. Set password to never expire for one user:

 

Set-MsolUser -UserPrincipalName username -PasswordNeverExpires $true

 

5. Set password to never expire for all users:

 

Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

 

6. Set password to never expire for a list of users:

 

like before create a txt list and run:

 

Import-csv c:\pwdexpire.txt | for each { Set-MsolUser -UserPrincipalName $_.username -PasswordNeverExpires $true }

 

7. to re-set the password to expire just replace the $true with $false (please note that is the organization’s password expiration period has passed then the user/users will be locked and you will need to reset their passwords)

 

source: http://www.e-apostol...ord-expiration/