If your company is anything larger than tiny and you are using Microsoft Office 365 or Azure, you will almost certainly run into a situation in which you want to a few user account set to not expire. Perhaps they are service accounts, or they are accounts that contractors rarely use.
You might be surprised to find that Microsoft’s official position is that you should not have your Microsoft 365 or azure accounts expire:
Password expiration requirements do more harm than good, because these requirements make users select predictable passwords, composed of sequential words and numbers that are closely related to each other. In these cases, the next password can be predicted based on the previous password. Password expiration requirements offer no containment benefits because cybercriminals almost always use credentials as soon as they compromise them.
https://learn.microsoft.com/en-US/microsoft-365/admin/misc/password-policy-recommendations?view=o365-worldwide&WT.mc_id=365AdminCSH_inproduct#password-expiration-requirements-for-users
Install-Module MSOnline
Connect-MsolService
Get-MsolUser -UserPrincipalName User@EmailAddress.com
Set-MsolUser -UserPrincipalName User@EmailAddress.com -PasswordNeverExpires $true
$user = Get-MsolUser -UserPrincipalName "user@domain.com" | Select-Object UserPrincipalName, PasswordNeverExpires, WhenCreated, LastPasswordChangeTimestamp
$user
This website uses cookies.