Find the Last Password Change using CMD

How to Find the Last Password Change using CMD in Windows 11?

Most organizations implement a Password Policy that requires their employees to change their passwords at regular intervals. Password policies are crucial for various reasons, primarily focusing on enhancing security and safeguarding data. In many organizations, password expiration is typically set at up to 90 days, and some also offer dual sign-in methods, with Windows Hello PIN being the default for many. Consequently, users may sometimes forget their passwords. Additionally, some individuals may habitually change their passwords periodically. If you’re interested in discovering the date and time of your last password change, this article provides a guide on using CMD in Windows 11 to find this information. If you are a Local account user then Finding the Last Password Change is pretty simple, we are going to use CMD or PowerShell to find the Last Password Change for Local User Account.

Find the Last Password Change using CMD in Windows 11:

You can check the Last Password Change of Local User Account using two different methods in Windows 11.

Using CMD or Windows Terminal:

Open Command Prompt or Terminal, admin access is not required since its related to your account.

Type the following command.

net user %username%

This is the very easiest method, in this method we use net user command, This command will list out the number of local user accounts on your computer, and this command will allow you to manage user accounts and groups. Using the above-mentioned command you can verify the Last Password Change date.

Once you hit enter, this will display the full details of the User Account, you can find the Password last set Date.

Make sure you have replaced the %username% to the actual Username. The same command will work in PowerShell.

Find the Last Password Change for local user

If you are a LDAP user, and your system is joined to the domain then you can use the following command to find the last password change date.

net user %username% /domain

Make sure you have replaced the %username% and domain name with the actual details.

Using PowerShell:

If you are a domain user and want to check the last password change using PowerShell then use the following steps. The following command works based on the Get-AdUser cmdlet from the Active Directory module installed. Without installing the Lightweight Directory Services, this cmdlet won’t work.

If you are using Windows Server then use the below-mentioned command to install the Get-AdUser cmdlet.

Install-WindowsFeature RSAT-AD-PowerShell

This command installs the RSAT active directory on your Windows Server, once you installed the RSAT AD, then you can use the Get-AdUser command.

If you are using a Windows Client operating system like Windows 10 or Windows 11, then you have to enable the Active Directory Lightweight Directory Services Windows feature.

Open the run command by pressing Windows + R and type appwiz.cpl and hit enter, this command will open the Programs and Features. From the left-hand side click on Turn Windows features on or off, click and open.

Check Active Directory Lightweight Directory Services and click on OK. Then type the following command to check the Last Password change date.

Find the Last Password Change
Get-ADUser -Identity %username% -Properties PasswordLastSet | Select-Object Name, PasswordLastSet

Replace the %username% with the respective Username, this command will show the Password Last Set date.

Check the Last Password Change for Azure AD user:

To check the last password, change for Azure AD user, use the following steps. In this method, we are going to use the MSOnline PowerShell module. So, make sure the MSOnline PowerShell module is installed or not, if not use the following commands to install.

Install-Module -Name MSOnline

After installing, PowerShell reverts to its command prompt.

Confirm that the installation was successful and that the MSOnline module is available on your computer. To do so, add the module to your current PowerShell session by running the Import-Module command below.

Import-Module MSOnline

 Once you Import the MSOnline PowerShell module, use the following script to find the Last Password Change date.

connect-MsolService
$specificUserUPN = "[email protected]"  # Replace with the UserPrincipalName of the specific user

$specificUser = Get-MsolUser -UserPrincipalName $specificUserUPN

if ($specificUser) {
    $specificUser | Select-Object DisplayName, UserPrincipalName, LastPasswordChangeTimeStamp
} else {
    Write-Host "User not found or does not exist."
}

Replace the $specificUserUPN variable, with your actual user email ID. This script will display the Last Password Change for the mentioned user name.

Read Also:

How to Reset Local User Account Password in Windows 11?

How to Show all users on Login Screen in Windows 11?

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top