Friday, December 30, 2011

Office 365: Set Password Never Expires

I had a client decide to use Office 365 for their hosted Exchange solution, but did not like the password change requirements the service had. I did some searching for a way to set the passwords to never expire and while there were a few places that had directions, none seemed to have a complete set listed step by step so I thought I would post them here in the hopes that maybe they can help someone else.
  • First you need a system with Microsoft Powershell installed. You can download this and find installation instructions for Powershell here.
  • Then you need to have the Microsoft Online Services Module installed which you can download here.
  • Now you will need to run the following commands in order.
  • $LiveCred = Get-Credential - You should then be prompted for your Office 365 admin credentials.
  • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection - You should see a few messages about redirection and then be returned to the prompt.
  • Import-PSSession $Session - You will again see a few messages on screen and should then be returned to the prompt. At this point we are connected and ready to work.
  • Connect-MSOLService - Connect to the MSOL Service
  • Get-MSOLUser - This will provide a list of the users and their User Principal Name which we will need for the next step.
  • Set-MSOLUser -UserPrincipalName user@domain.com -PasswordNeverExpires $true -StrongPasswordRequired $true - This will change a single user account's password to never expire. If you want to change all user accounts use the next command.
  • Get-MSOLUser | Set-MSOLUser -PasswordNeverExpires $true - This will set all accounts to have non expiring passwords.
  • Remove-PSSession $Session - Clean up and close our session when done.
I am not a Powershell expert, but these steps in that order worked well for me so hopefully they are helpful to someone else as well.

1 comment:

  1. Getting MS to allow a no-expiration policy for my small business customers was the holy grail of my 1st 12 months for customers we moved to on Online Services > Office 365. We literally moved 5 or more business back off MS' service purely due to the management overheads it caused. Allowing it was the most sensible thing they did for small business customers. Hope you don't mind me pinching the instruction set for my own blog, and leaving you a ping back! Thanks, Dom

    ReplyDelete