In this tutorial, we’ll learn how to check for the password expiration date in Active directory using PowerShell.
You can display detailed information of a specific users’ password expiration using the following syntax:
net user USERNAME /domain
For example, to display the password expiration information of the user “jdoe” we will run the following command in the PowerShell:
PS C:\Users\jdoe> net user jdoe /domain The request will be processed at a domain controller for domain OrgDomain.com. User name jdoe Full Name John Doe Comment Server Administrator User's comment Country/region code (null) Account active Yes Account expires Never Password last set 11/23/2021 7:39:45 AM Password expires 2/21/2022 7:39:45 AM Password changeable 11/24/2021 7:39:45 AM Password required Yes User may change password Yes =========Below this line omitted==============
There is a lot of useful information you can get after executing the above command, but if you only wanted the expiration date, we can pipe for only the information we need.
PS C:\Users\jdoe> net user jdoe /domain | find "Password expires" Password expires 2/21/2022 7:39:45 AM