Need a way to set the "Password Never Expires" checkbox in a user account from a command line

EKSH-Tech
EKSH-Tech used Ask the Experts™
on
Hello,
I need a command that will allow me to change the "Password Never Expires" checkbox for a local user account.  I know how to change this manually through local users/groups but I need to push this out to hundreds of PC's in several offices so doing it manually isn't really an option.  Using the "net user" command I have been able to alter just about every property in the user account except for the "Password Never Expires".  I know I can use "net accounts /maxpwage:unlimited" to set the password to never expire for ALL users, but is there a command that will let me set this property for just one local user on the PC?  All the PC's I need to change are running Windows XP SP3 and are all in the same Windows domain, so if you know of a way to accomplish this through a group policy that would work also.  Thanks,

EKSH-Tech
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This should work...

net user {username} /expires:never


according to:
http://www.ss64.com/nt/netuseroptions.html
http://www.ss64.com/nt/net_useradmin.html
Systems Engineer
Top Expert 2007
Commented:
Try following command line statement:

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

Open in new window

Allow all local user accounts to never expire, and with a group policy change the right to log in to local admin users. That way the local users can't be used to log in anymore.

Or leave the pwd change rule and change the pwd with a net use command in a batch file which goes through all your pc's periodically ( with the new pwd as a variable at the top....

Author

Commented:
This is exactly what I was looking for.  Thank you!!

Author

Commented:
Unfortunately the "net user /expire:never" command only sets the account to never expire, not the password.  I tried the WMIC command and it worked perfectly, so I won't need to go modify any group policies.  Thanks much for your prompt answers!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial