Set yourself up to connect to the service through PowerShell remoting. If you have not done this yet, you will need two pieces of software: the Microsoft Online Services Sign-In Assistant for IT Professionals RTW (yes, that’s the official name) and the Azure Active Directory Module for Windows PowerShell.
- Install both programs.
- Open up a PowerShell command session and type in “Connect-MsolService”.
- Enter your credentials at the prompt.
- Once you are successfully authenticated, enter the following command to set a user’s password to never expire:
Set-MsolUser -UserPrincipalName <[email protected]> -PasswordNeverExpires $true
If you know a little bit about PowerShell, then you know that, if the verb in a command is “Set,” you can also use “Get” to retrieve information or properties about a certain object. In this case, you can use “Get-MsolUser” to see if the user’s password has already been configured to never expire; to do so, you use the following command, which selects the attribute to display in response to our command:
Get-MsolUser -UserPrincipalName <[email protected]> | Select PasswordNeverExpires
You can extrapolate from this command to see the password expiration statuses of all users in your tenant using the following command:
Get-MSOLUser | Select UserPrincipalName, PasswordNeverExpires
You can also combine these commands to set the passwords for all users in your tenant to never expire; this is done using the pipelining feature of PowerShell. Here, you get a list of users from “Get-MsolUser” and then pipe that information to “Set-MsolUser,” omitting the specific reference to names (as those will be fed into the new command from the pipeline) and leaving the attribute configuration the same:
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $true
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article