Information Technology Reference
In-Depth Information
For example, to create a user account named BSmith in the Sales OU, which is in the
Marketing parent OU in the w2k8ad99.com domain, the command is as follows:
DSADD user CN=BSmith,OU=Sales,OU=Marketing,DC=w2k8ad99,DC=com
To create a computer account named New Computer in the Computers folder in the same
domain, the command is as follows:
DSADD computer "CN=New Computer,CN=Computers,DC=w2k8ad99,DC=com"
The quotation marks around the distinguished name path are required if the path contains
any spaces, including after commas. In this example, the computer name New Computer has a
space in it.
Following the DN, a command can include options specified with this syntax:
5
- OptionName OptionValues
For example, if you want to add BSmith and include the first name and last name attributes,
the command uses the -fn and -ln options, as shown:
DSADD user CN=BSmith,OU=Sales,OU=Marketing,DC=w2k8ad99,DC=com -fn
Bill -ln Smith
The DSADD command's syntax is somewhat intimidating, and if you had to type this entire
command over and over, you might start to wonder how useful it is. The command's usefulness
is apparent, however, when you have to create several accounts with similar properties except a
few that are unique for each user. You can construct the command once in a batch file with a
placeholder for the unique information that varies each time the command is used. For example,
you could type the following command in a text file saved as uadd.bat:
The variables in this command are indicated with italics. When you type
the actual command, however, you don't use any text formatting.
DSADD user "CN= %1 ,OU=Sales,OU=Marketing,DC=w2k8ad99,DC=com" -fn %2
-ln %3 -pwd Password01 -memberof Sales-G -mustchpwd yes
This command creates a user in the specified container and domain, assigns the password
Password01, places the user in the Sales-G group, and requires that the user change the password
at next logon. The %1, %2, and %3 are variables replaced with username, first name, and last
name. For example, to run the uadd.bat batch file to create a user named Susan Martin with the
username SMartin, you enter the following:
uadd SMartin Susan Martin
For each user you need to create, you have to specify only the username, first name, and last
name. If you have several users with similar properties to create, you could complete the task con-
siderably faster than in Active Directory Users and Computers, even if you used a user template.
Activity 5-11: Creating a Batch File for the DSADD Command
Time Required: 20 minutes
Objective: Create a batch file for the DSADD command.
Description: A new department, Advertising, has been added to your company, and 15 new
employees will be hired immediately. You have already created the OU structure to accommodate
this new department: the Advertising OU under the Marketing OU. All users will belong to a
global group called Advert-G, which you need to create first.
1. If necessary, log on to your server as Administrator and open Active Directory Users and
Computers.
2. Click to expand the Marketing OU, and then click the Advertising OU.
 
Search WWH ::




Custom Search