?
Solved

Batch File user account to Password to Never Expire

Posted on 2007-10-04
7
Medium Priority
?
9,017 Views
Last Modified: 2012-05-05
Hi I have created the batch file below which I want to have password does not expire checkbox ticked in manage local users. We have deployed this batch file and after 2 month the passwords on the PC's started to expire. So I need to amend the batch file below for new PC's and also create another batch file to change the password of the itadmin account and set it to never expire.

below you will notice that the net accounts /maxpwage is set to unlimited, which has not worked for us. I dont know why.

::This create the IT Admin User Account
net user /add ITAdmin MyPassword /fullname:ITAdmin /comment:IT /expires:never
::This assigns the username ITAdmin to have administrative rights
net localgroup administrators ITAdmin /add
::This sets the password to never expire
net accounts /maxpwage:unlimited
0
Comment
Question by:harps21k
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:elec1cele
ID: 20013447
I believe you want net accounts /maxpwage:0  0 in this case means unlimited
0
 
LVL 26

Accepted Solution

by:
Farhan Kazi earned 2000 total points
ID: 20013539
Greetings Harps21k,
Have a look at following:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_accounts.mspx?mfr=true

/maxpwage:{days | unlimited} : Sets the maximum number of days that a user account's password is valid. The unlimited value sets no maximum time.  

I don't think it can set 'Password Never Expires' attribute.
For setting this attribute you can use following statement in batch file.

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

Hope this helps!
0
 

Author Comment

by:harps21k
ID: 20014051
Hi farhankazi,

Thats Excellent, it works. Also can you help as I want to change the default Administrator account password using a batch file.
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 20014154
You can change password using NET USER command
Like:
NET USER Administrator P@ssw0rd
                                                ^----------- New Password for user Administrator
0
 

Author Comment

by:harps21k
ID: 20014264
Hi farhankazi,

If I wanted to hide the password from other IT Engineers for security reason when changing the administrator password how would I with the batch cmd below.
NET USER Administrator P@ssw0rd
Try to encrypt or hide the password, when changing it. So Engineer cant right click, edit and view it in notepad.
0
 
LVL 26

Expert Comment

by:Farhan Kazi
ID: 20014315
Actually you can not hide/encrypt password inside batch file. The only option (that i know) is to convert that batch file to .exe format.

If you convert batch file to executable then its code will not be understandable to users.
The tool that I use for this purpose is "Bat_To_Exe Converter" (Good one & Freeware)

Download it from:
http://www.f2ko.de/English/b2e/download.php
0
 

Author Comment

by:harps21k
ID: 20016829
Thanks farhankazi. Its been very helpful
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question