Archivo

Entradas Etiquetadas ‘password expiration’

Disable password expiration on Office365 accounts

martes, 8 de enero de 2013 Sin comentarios

Spain__Flag-679

 

Before beginning this post, i must say that this is only possible via powershell, so we must have our environment ready for office365, if you don´t have it, click here to get it done..

If you alredy have the envornment ready for it, then proceed with the following code:

  • $LiveCred = Get-Credential (Get credentials to log on our office365 subscription)
  • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection (configure the type of session)
  • Import-PSSession $Session (import the session from the server)
  • Connect-MsolService (connect to Online services and input one more time our admin credentials)
  • Get-MsolUser -UserPrincipalName user@contoso.com | Set-MsolUser -PasswordNeverExpires $true (specify that the user user@contoso.com to never expire his password)

If we want to apply for all users created, then run the following commands:

  • Get-MsolUser | Set-MsolUser -PasswordNeverExpires $true
  • Get-MsolUser | Select UserPrincipalName, PasswordNeverExpires

Hope it helps someone.