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

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 :(

W2K8 R2


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

I tried to club it with


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()

Problems with C#


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!

You are my hero


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!!!


Works with Windows 7 too!!!

Thanks!


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


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


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's wonderfulhegim


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

Thanks again.

The Wichita Computer Guy is hosted by one of the best hosting companies on the market: Hostgator.com. Not only do they provide unlimited domain addons, subdomains and parked domains, they also offer unlimited databases, unlimited hosting space and unlimited bandwidth! We have been using Hostgator for several years now and had great customer service support and almost 100% uptime. If you are looking for a website hosting company that provides everything you need for a powerful CMS based website, take a look at Hostgator.com!!