TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Operating Systems > Windows 98/2000/ME/XP/2003/Vista

Notices

How do i Create new users with a .bat file in Windows xp?

Windows 98/2000/ME/XP/2003/Vista


Reply
 
Thread Tools Display Modes
Old 22-10-2009, 07:42 PM   #1
Newbie
 
Join Date: Oct 2009
Age: 23
Posts: 2
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0 Vaughanschoeman is an unknown quantity at this point


OS: Windows XP


How do i Create new users with a .bat file in Windows xp?

can anyone help me, i need to add many of the same users onto several PC's so i want to create a .bat file that i run on each pc

But i want the users to be part of the guest account only, also the 'User Cannot Change Password' and 'Password never expires' Must be ticked

i have been able to add a user using this command that i found online:

Code:
@echo off
start
net user /add User1 password
net localgroup administrators User1 /add
net share concfg=C:\ /grant:User1, full
net user User1 password
but that puts them in the Administrators group and they are allowed to change passwords

please

Last edited by Strider; 22-10-2009 at 08:04 PM..
Vaughanschoeman is offline   Reply With Quote
Old 22-10-2009, 08:05 PM   #2
Founder
 
Strider's Avatar
 
Join Date: Nov 2005
Location: The Last City Zion!
Posts: 3,539
Thanks: 287
Thanked 345 Times in 298 Posts
Rep Power: 62 Strider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just GreatStrider is just Great


OS: Windows XP Windows Server 2003 / Windows Server 2008 Windows Vista Windows 7 Linux


Re: How do i Create new users with a .bat file in Windows xp?

What if you remove the line net localgroup administrators User1 /add from the batch script?

Here is a neat net command reference:

http://ss64.com/nt/net_useradmin.html

Last edited by Strider; 22-10-2009 at 08:08 PM..
Strider is offline   Reply With Quote
Thanked Users:
Vaughanschoeman (22-10-2009)
Old 18-11-2009, 03:31 AM   #3
Newbie
 
Join Date: Nov 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 tbam88 is an unknown quantity at this point


OS: Windows XP


Re: How do i Create new users with a .bat file in Windows xp?

Replace the code in your BAT file with the lines below. This will create a "Limited Account" With NO password.


@echo off
start
net user /add User1
net localgroup guest User1 /add
net share concfg=C:\ /grant:User1, limited
tbam88 is offline   Reply With Quote
Old 18-11-2009, 09:50 AM   #4
Newbie
 
Join Date: Nov 2009
Age: 33
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 dolreich_c is an unknown quantity at this point


OS: Windows 98 / Windows ME Windows NT / Windows 2000 Windows XP Windows Server 2003 / Windows Server 2008 Windows Vista Windows 7 Linux


Re: How do i Create new users with a .bat file in Windows xp?

Hi ,

Are you using Active Directory? If so, DSADD is the right tool.

Create an Excel spreadsheet with 2 tabs. One tab (UserInformation) is populated with the following column names in ROW1 (the values by each are the formulas in row 2 - if not a data string value):
A- SAM Name
B- FirstName
C- LastName
D- Description
E- Password
F- UPN = =A2&"@xx.company.com"
G- Display = =B2&" "&C2
H- Office
I- Email = =B2&"."&C2&"@xx.company.com"
J- MustChangePwd = yes/no
K- Disabled = yes/no
L- LoginScript = login.bat
M- cn= =A2
N- ou= =users
O- ou= =newOU
P- dc= =xx
Q- dc= =company
R- dc= =com
S- -samid =A2
T- -upn =CONCATENATE(AE2&F2&AE2)
U- -fn =CONCATENATE(AE2&B2&AE2)
V- -ln =CONCATENATE(AE2&C2&AE2)
W- -desc =CONCATENATE(AE2&D2&AE2)
X- -display =CONCATENATE(AE2&B2&" "&C2&AE2)
Y- -pwd =E2
Z- -office =H2
AA- -email =CONCATENATE(AE2&I2&AE2)
AB- -loscr =L2
AC- -mustchpwd =J2
AD- -disabled =K2
AE- "

Create as many rows as necessary in this for each of the users. A second tab would be named DSadduserTemplate and the contents of row 2 and below would be:
="dsadd user cn="&UserInformation!M2&",ou="&UserInformation!N2& ",ou="&UserInformation!O2&",dc="&UserInformation!P 2&",dc="&UserInformation!Q2&",dc="&UserInformation !R2&" -samid "&UserInformation!S2&" -upn "&UserInformation!T2&" -fn "&UserInformation!U2&" -ln "&UserInformation!V2&" -desc "&UserInformation!W2&" -display "&UserInformation!X2&" -pwd "&UserInformation!Y2&" -office "&UserInformation!Z2&" -email "&UserInformation!AA2&" -loscr "&UserInformation!AB2&" -mustchpwd "&UserInformation!AC2&" -disabled "&UserInformation!AD2

Copy this down as many rows as needed. Once this information is populated with values from the UserInformation tab, you can copy this to a BAT or CMD file and execute. Modify as needed to change values for groups.

The command actually looks something like:
dsadd user cn=0,ou=users,ou=YOUROU,dc=xx,dc=company,dc=com -samid 0 -upn @xx.company.com -fn 0 -ln 0 -desc "" -display " " -pwd changeme -office Location -tel 0 -email .@xx.company.com.com -loscr login.bat -mustchpwd No -disabled Yes

We created the new users as disabled so we could add them to groups as needed and then train them on how to use their new logins.

Good luck

Cheers
dolreich_c is offline   Reply With Quote
Old 20-11-2009, 06:22 PM   #5
Junior Member (25+)
 
Join Date: Nov 2009
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 horheg is an unknown quantity at this point


OS: Windows XP Windows Vista Linux Mac OS


Re: How do i Create new users with a .bat file in Windows xp?

For creating local users try out tbam88's advice.
If the PC's you want to create users on are part of the same domain you could create them only once:
Create new NETWORK users using BATCH FILE in XP...? - Yahoo! Answers
horheg is offline   Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 05:20 AM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional