batch file to create users and groups
40 pts.
0
Q:
batch file to create users and groups
how do I Create a set of scripts that can use any text file to create new groups and users and assign the users to the correct groups. Full Names and user names must be set for the users.

Also, where could i find a good reference site for commands that I may use to create batch files of my own?

I'm using windows XP and i'm not a skilled batch file maker yet. i don't know where to get started or implament it.

thank you very much
ASKED: Dec 4 2008  5:38 PM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
26245 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Are you using Active Directory? If so, DSADD is the right tool. See these threads.

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!P2&",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.
Last Answered: Dec 4 2008  9:17 PM GMT by Labnuke99   26245 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Technochic   40210 pts.  |   Dec 4 2008  6:38PM GMT

Will these be users and groups in Active Directory? What functional level is the domain and what windows server versions are in the domain? What server version levels are the DC’s?

 

EricGagne   40 pts.  |   Dec 4 2008  6:51PM GMT

yes it will be in active directory, and all of this is for my own it improvement so i am implementing everything on a virtual machin with a microsoft xp OS installed

 

EricGagne   40 pts.  |   Dec 4 2008  6:56PM GMT

i need to be capable of using a text file with a list of name and groups. the batch file i would like to creat would need to take this list of names (users) and department (groups) and to implament one after the other a new user name (which will be there own name on the list) and put them within their rightfull group (which will be between 3 departments) the list i am trying to use is 26 names and 3 different deppartments where the departments are not in alphabetical order from top to bottom in the list.

 

Labnuke99   26245 pts.  |   Dec 4 2008  8:08PM GMT

DSADD is your friend then. We did this for several thousand users in our environment. Did this for initial group setups also.

 
0