MS O365 Admin - Never Expire User Password

Prev Next

Goal: To set a single user account password to never expire in Office 365

Requisites: Must have an Office 365 Global Admin Account and knowledge of how to run PowerShell

Copy the script below into PowerShell and change the username in red on the last line and run the script

$cred = Get-credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session –AllowClobber
Import-Module MsOnline
Import-Module MSOnlineExtended
Connect-MsolService -Credential $cred
Set-MsolUser -UserPrincipalName username@domain.com -PasswordNeverExpires $true