Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create multiple User accounts

Status
Not open for further replies.

GSC

MIS
Mar 27, 2001
464
EU
Hi Guys,
Just got a request to create 113 user accounts. Is there somebody out there that knows how to do this with a batch file or something that's easier than creating them manually.
Also Exchange mailboxes will be needed for this accounts, some help would be appreciated here.
Thanks A LOT for any help.
Regards,
GSC
 
It's pretty easy to script domain account creating, but I haven't seen a script for Exchange account creation yet.

A script for account creation can be as simple as something that uses 'net user' commands. Here's one I use, with comments:

-------------------------
# Script is named 'newuser.cmd'.
# This file takes up to four input parameters:
# username, password, full name, and group name
# the first entry adds a user to the domain
net users %1 %2 /add /fullname:%3 /domain
#the next line adds user to a group
net group %4 %1 /add /domain
#these commands create directories on the file server
#that will be used for home directories
md \\fileserver\users\%1
md \\fileserver\users\%1\exchange
wait 10
#this command creates a hidden share on the fileserver
rmtshare \\fileserver\%1$=e:\users\%1
#this command syncs the account databases so that future
#instructions will run regardless of where
#authentication happens
rcmd \\PDC net accounts /sync
wait 50
#the next two commands set the home directory
#and logon script parameters
net users %1 /HOMEDIR:\\fileserver\%1$ /DOMAIN
net users %1 /SCRIPTPATH:LOGIN.BAT /DOMAIN
#this last command sets the home directory
permissions cacls \\fileserver\users\%1 /G Administrator:F %1:F
cacls \\fileserver\users\%1 /G EVERYONE:R
-------------------------------
I then start with an excel spreadsheet of all the user names and make it so that the first column has 'newuser.cmd' in every row and make sure that the 'full name' entry is in quotes. I export the spreadsheet to CSV and delete all commas through 'find/replace'. Now I have a batch file that relies on the script detailed above to create as many accounts as I had listed in my Excel file with a mere mouseclick.

Some of the commands I use are from resource-kit utilities, so make sure that's handy.

ShackDaddy
 
the second to last line in the script that starts 'permissions' is wrong. The first would is 'calcs' and 'permissions' should be part of the comment above.
 
You can use addusers.exe to create the NT accounts. It is a resource kit utility.

For Exchange, put all the account information on a spreadsheet and import the information into Exchange.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top