Reference:
Set the Password never expires attribute
To set the Password never expires attribute for AD users:
$User = (Read-Host -Prompt “Username")
Set-ADUser -Identity $User -PasswordNeverExpires $true
Set the password expiration date
You can extend the validity of an AD password by setting the pwdlastset attribute to -1, which sets the value of the attribute to the current date and time.
$Username = (Read-Host -Prompt “Username")
$User = Get-ADUser $Username -Properties pwdlastset
$User.pwdlastset = 0
Set-ADUser -Instance $User
$User.pwdlastset = -1
Set-ADUser -Instance $User
發表留言