16.1. Creating a User Account


You want to create a user account in Active Directory.


Using a graphical user interface

  1. Open the Active Directory Users and Computers (ADUC) snap-in.

  2. If you need to change domains, right-click on Active Directory Users and Computers in the left pane, select Connect to Domain, enter the domain name and click OK.

  3. In the left pane, browse to the parent container of the new user, right-click on it, and select New User.

  4. Enter the values for the first name, last name, full name, and user logon name fields as appropriate and click Next.

  5. Enter and confirm the password, set any of the password flags, and click Next.

  6. Click Finish.

Using a command-line interface

> dsadd user "<UserDN>" -upn 
<UserUPN> -fn "<UserFirstName>" -ln "<UserLastName>" -display "<UserDisplayName>" -pwd <UserPasswd>

Using VBScript

' The following code creates a user object and sets several attributes.
set objParent = GetObject("LDAP://<ParentDN>") 
set objUser   = objParent.Create("user", "cn=<UserName>") ' e.g., joes
objUser.Put "sAMAccountName", "<UserName>"   ' e.g., joes
objUser.Put "userPrincipalName", "<UserUPN>" ' e.g., joes@rallencorp.com
objUser.Put "givenName", "<UserFirstName>"   ' e.g., Joe
objUser.Put "sn", "<UserLastName>"           ' e.g., Smith
objUser.Put "displayName", "<UserFirstName> 
                  <UserLastName>" ' e.g., Joe Smith
objUser.AccountDisabled = FALSE


In Windows 2000 Active Directory, the only mandatory ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.