Set Office 365 Passwords to Never Expire

In BPOS, users would at least get a warning when they logged in. In Office 365, we’re seeing passwords expire and nobody knows why their Outlook or Lync suddenly stopped working. You can always have someone go to Portal.Microsoftonline.com and reset their password – it’s rather simple. But even less of a headache? Make it so that their passwords don’t expire. Follow the step by step below:

Download & install the cmdlet programs (you may
already have these and be using them).

  • Microsoft Online Services Sign-In Assistant (IDCRL7) (32 or
    64-bit).
  • Microsoft Online Services Module for Windows PowerShell (32 or 64-bit).

Now launch the Microsoft Online Services Module for Windows PowerShell
from your desktop or start menu and enter each of the following commands one at a time (each bullet
point is one command NOTE that some commands may span more than one line due to web formatting – look for the actual BULLET POINTS to show you the beginning of each new command and copy it entirely).

  • $LiveCred = Get-Credential
  • $Session = New-PSSession -ConfigurationName Microsoft.Exchange
    -ConnectionUri https://ps.outlook.com/powershell/ -Credential
    $LiveCred -Authentication Basic -AllowRedirection
    • ENTER YOUR ADMIN USER CREDENTIALS (admin@xyz.microsoftonline.com &
      a password).
  • Import-PSSession $Session
  • Connect-MSOLService
    • ENTER YOUR ADMIN CREDENTIALS AGAIN
  • Get-MSOLUser | Set-MsolUser -PasswordNeverExpires $true

And now you’re all set! Passwords won’t expire any more and passwords which have expired already will begin working again within minutes.

Comments

  1. Raj Avatar
    Raj

    error at the step connect-MSOLservice
     

  2. NuAngel Avatar

    Raj, what is the error?  You may need to right click and run the PowerShell as Administrator.

    http://community.office365.com/en-us/f/148/t/8362.aspxIn that same forum post I just linked to, Yonis_MSFT also suggests:

    The reason for the error I pasted above was the registry value for the “WebServiceUrl” was pointing to a different URL domain from the domain I was logining in to the UI.
    Vbelyavtsev,
    Try cheking your registry value for key “HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSOnlinePowerShellPath”, “WebServiceUrl”
    The format is like below.
    https://provisioningapi./provisioningwebservice.svc
    Thanks
    Yonis

  3. Ben Avatar
    Ben

    I have discovered a small change to the syntax on the Connect-MSOLService line.

    You can enter:

    Connect-MSOLService -Credential $LiveCred

    and it will keep you from having to enter your credentials again, assuming your entered them correctly the forst time when you set the variable.

    1. NuAngel Avatar

      Ah, yes, that would make sense since it’s using the $LiveCred variable!

      Thanks for sharing the tip!

Leave a Reply

Your email address will not be published. Required fields are marked *