PasswordNeverExpires: Disable Password Expiration

A password expiration is a feature in Windows that forces users to change their passwords after a certain number of days.

When it is time to change your password, Windows will send you a “Consider changing your password” notification.

In this note i will show several ways of how to disable the password expiration of a local user account in Windows.

Cool Tip: How to determine whether the current user is a Domain User account or a Local User account! Read more →

Disable Password Expiration in Windows

Here is how the “Consider changing your password” notification looks like:

The local user account’s password can be set to never expire by checking the “☑️ Password never expires” checkbox in the “Local Users and Groups” settings or by setting the PasswordNeverExpires from the PowerShell or by using the wmic command from the Windows command prompt (CMD).

☑️ Password Never Expires

To open the “Local Users and Groups” settings, press ⊞ Win + R that will start the “Run” dialog, type in the lusrmgr.msc command and click “OK”:

In the “Local Users and Groups”, open the “Users” folder, select the user account which password you want to set to never expire, right-click on it and select the “Properties”:

Check the “☑️ Password never expires” checkbox to permanently disable a password expiration for the selected account and click “OK”:

Set “PasswordNeverExpires” using PowerShell

Start the PowerShell as an administrator: press ⊞ Win keybutton to open the Start menu, type in powershell to search for the PowerShell and press Ctrl + Shift + Enter to launch it as administrator.

To get the list of active local user accounts with their password expiration dates, execute:

PS C:\> Get-LocalUser | Where-Object { $_.Enabled } | Select Name,PasswordExpires
- sample output -
Name    PasswordExpires
----    ---------------
Admin   3/17/2022 1:32:17 PM
Alice   7/28/2022 6:48:59 PM

Use the command as follows to set the PasswordNeverExpires to 1 and disable the password expiration for the particular local user account:

PS C:\> Set-LocalUser -Name "<UserName>" -PasswordNeverExpires 1
- example -
PS C:\> Set-LocalUser -Name "Alice" -PasswordNeverExpires 1

List the local user accounts once again and check the PasswordExpires field:

PS C:\> Get-LocalUser | Where-Object { $_.Enabled } | Select Name,PasswordExpires
- sample output -
Name    PasswordExpires
----    ---------------
Admin   3/17/2022 1:32:17 PM
Alice

The empty PasswordExpires field means the password for this user will never expire.

Disable Password Expiration using CMD (wmic)

Start the CMD as an administrator: press ⊞ Win keybutton to open the Start menu, type in cmd to search for the command prompt and press Ctrl + Shift + Enter to launch it as administrator.

To get the list of local user accounts, execute:

C:\> net user
- sample output -
User accounts for \\COMPUTER

-------------------------------------------------------------------------------
Admin                    Alice                    Bob
The command completed successfully.

Use the command as follows to set the PasswordExpires to false and disable the password expiration for the particular local user account:

C:\> wmic useraccount where "Name='<UserName>'" set PasswordExpires=false
- sample output -
Updating property(s) of '\\COMPUTER\ROOT\CIMV2:Win32_UserAccount.Domain="COMPUTER",Name="Alice"'
Property(s) update successful.

To ensure that the password expiration is disabled, execute:

C:\> net user <UserName> | findstr /c:"Password expires"
- sample output -
Password expires             Never

Cool Tip: How to find a user’s SID (security identifier) in Windows! Read more →

Was it useful? Share this post with the world!

Leave a Reply