Learn how to configure a user account so that the password never expires. This can be done from Windows command prompt as well as in “local user accounts” console.
Set password to never expire from CMD
Run the following steps to disable password expiry from command line.
- Open elevated admin command prompt
- Run the command.
WMIC USERACCOUNT WHERE Name='username' SET PasswordExpires=FALSE
Example: To never expire password of administrator account.
c:\>net user administrator | findstr /C:expires Account expires Never Password expires 9/12/2017 9:02:26 PM
You can see above that the password would expire on 9/12. Now we are going to change that.
c:\>WMIC USERACCOUNT WHERE Name='administrator' SET PasswordExpires=FALSE Updating property(s) of '\\MYPC\ROOT\CIMV2:Win32_UserAccount.Domain="MYPC",Name="administrator"' Property(s) update successful.
Checking password expiry date now
c:\>net user administrator | findstr /C:expires Account expires Never Password expires Never
Using User accounts console
Do the following steps to disable password expiry in user account console.
- Execute the command
lusrmgr.msc
from Run. - Click on users in the list displayed on the left side
- Double click on the user account you would like to update
- Select the check button
Password never expires
. Click OK
Add double quotes in after the WHERE keyword like “Name=’admin'” on all queries. Otherwise you will get invalid query error
it works perfect and it’s very useful
Does net user have an argument to set password never to expire. I’m trying to do it without wmic
this is what I get:
Unexpected switch at this level.
You can use the net command to set all accounts to never expire passwords:
net accounts /maxpwage:unlimeted
This also works for an entire Active Directory domain by adding the /domain parameter:
net accounts /maxpwage:unlimited /domain
I tested last option on an server 2016 domain controller.
When I try on a different PC, some PC responds “WMIC is not recognized as an internal or external command,operable program or batch file.” Do you have any idea why will show up this error message?