Password Never Expires on Local Account XP, Vista, Windows 7 Command Line

Author:
phil
Created:
Monday, May 10th, 2010
Last Updated:
Thursday, June 02nd, 2011

Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service


I searched all over the place for about an hour before finally running across the EASIEST solution to setting a local user account "Password Never Expires" checkbox for Windows XP. If you've tried NET USER (user) /EXPIRES:NEVER You will find that this does not work... the reason is because that is applied to the account never expiring, not the password...

So, for the easy fix to setting "Password Never Expires" on a local account in XP, open the trusty ol' command prompt and enter:

WMIC USERACCOUNT WHERE "Name='username_here'" SET PasswordExpires=FALSE

For example, on the administrator account, you would type:

WMIC USERACCOUNT WHERE "Name='Administrator'" SET PasswordExpires=FALSE

That's it!

Note: I need to make the quick disclaimer that this tool is mainly only for business class Windows computers (Pro) because it is considered an "admin" tool. (I don't know about Vista home or Win 7 home) So, if you are running XP Home or the like, you probably don't have the tool :(

Post Comment

Comments

I appreciate this info. It has helped me half a dozen times over the years. Thanks.

Confirmed with W2K8 R2 as well... Thanks a lot!

I tried to club it with Process class in c#. It did not work.

processObj = New Process()
processObj.StartInfo.WorkingDirectory = "C:\WINDOWS\SYSTEM32"
processObj.StartInfo.FileName = "cmd.exe"
processObj.StartInfo.UseShellExecute = False
processObj.StartInfo.RedirectStandardError = True
processObj.StartInfo.RedirectStandardOutput = False
processObj.StartInfo.WindowStyle = ProcessWindowStyle.Hidden

processObj.StartInfo.Arguments = "WMIC USERACCOUNT WHERE ""Name='" & userName & "'"" SET PasswordExpires=FALSE"

processObj.Start()
processObj.WaitForExit()
processObj.Close()

Well, I wish I could help you out in that area, but C# is not one of my area's of expertise... I hope you are able to figure something out!

Fantastic Job! This works great. Those of us who have to manage PCs in a non-AD environment owe you a serious debt of gratitude.

Works with Windows 7 too!!!

Thanks for the update! I changed the title of the page to reflect Vista and Windows 7 since they both utilize the WMIC command as well :)

many thanxxx to your solution .. i was searching about this issue more than 3 days .. finally your command works and solve my issue..

Gracias, sos un genio estuve 3 horas buscando la solucion. gracias

Translated:
Thanks, you're a genius I was three hours looking for the solution. thanks

It is the command I wanted. Thank you so much for writing this post.

Thanks again.