'Setting password expiration date of specific User

I want to change password expiration date for a particular AD user to date 4/14/2022 through powershell script.

Get-ADUser -identity user01 –Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed" |
Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Displayname        ExpiryDate          
-----------        ----------          
User01             9/12/2022 8:54:59 AM


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source