Thursday, April 25, 2013

Disable password expiration in Office365

Open Powershell

Connecting to the Office 365 servers
$cred=Get-Credential
connect-MSOLService -credential $cred
 
After typing the first line, you will be asked to authenticate, you need to authenticate with a user who has administration privileges.

Disabling password expiration for all accounts
Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true
 
Disabling password expiration for one account
You might want to check first if the user already has it’s password expiration set. This is done quite easily

Get password expiration status for all users
Get-MSOLUser | select UserPrincipalName, PasswordNeverExpires

Get password expiration status for specific user
Get-MSOLUser -UserPrincipalName myemail@here.com | Select PasswordNeverExpires

Setting the password to never expire
Set-MsolUser -UserPrincipalName myemail@here.com -PasswordNeverExpires $true

No comments:

Post a Comment