How can I add a user to Active Directory (AD) from the command line without using a script?

A. Windows Server 2003 provides the Dsadd command, which lets you add objects (e.g., computers, contacts, groups, organizational units--OUs, quotas, users) to AD. The basic command syntax is

dsadd user <users's distinguished name (DN)> -samid <username> -pwd <new password>

For example, to add user John to AD, I typed

C:\> dsadd user CN=John,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com -samid John -pwd Pa55word

The system returned

dsadd succeeded:CN=John,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com

For a full list of options, type

C:\> dsadd user /?

The options let you set the user's full name details, email, group ownership, and Web page as well as set the password to never expire. The following example shows the use of several of these options:

C:\>dsadd user CN=John,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com -samid John -pwd Pa55word -fn John -ln Savill -display "John Savill" -email john@savilltech.com -webpg http://www.savilltech.com -pwdneverexpires yes -memberof "CN=Domain Admins,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com"

dsadd succeeded:CN=John,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com

Notice that the "-memberof" option, which specifies the user's group ownership, is in quotes because the DN contains spaces.

Discuss this Article 10

Anonymous User (not verified)
on Feb 2, 2005
Very good eks. I where looking on other site for 2 hours, and found noting. This eks. works. thank you. ;)
MigrationKing
on Jun 18, 2011
Here is a better tutorial and example for people that don't have alot of time to type this stuff up. http://blog.migrationking.com/2011/06/active-directory-bulk-user-import-using.html
Anonymous User (not verified)
on Mar 27, 2005
great ;) But what about: when I have created user account, and now I want to add this user to another group.
Anonymous User (not verified)
on Jul 21, 2005
Why is CN declared twice, what about DC?
Anonymous User (not verified)
on Nov 5, 2004
if i want to add multiple users using the command-line utility DSADD User, how do I do this? If i just use DSADD User and hit i get to enter DN strings but it doesn't work. Any ideas?

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottYou'll have the opportunity to experience:
• The Microsoft
Technology Roadmap
• Office 365 Implementation
• Hyper-V Optimizing
• Windows 8 Deployment
and much more!

Come See Paul Thurrott & Rod Trent in Person!

Early Registration Now Open

Upcoming Training

Mastering System Center 2012

During over 6 hours of training you can join John Savill from your computer as he will walk you through the key components and capabilities of System Center 2012, what’s involved in using the components, and the benefit they can bring to your environment.

Register Now

Current Issue

May 2013 - The NameTranslate object is useful when you need to translate Active Directory object names between different formats, but it's awkward to use from PowerShell. Here's a PowerShell script that eliminates the awkwardness.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

Get answers to questions, share tips, and engage with the Windows Community in our Forums.