September 2003
Intermediate to advanced
624 pages
15h 49m
English
You want to create a
user
object.
Open the Active Directory Users and Computers (ADUC) snap-in.
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.
In the left pane, browse to the parent container of the new user, right-click on it, and select New → User.
Enter the values for the first name, last name, full name, and user logon name fields as appropriate and click Next.
Enter and confirm password, set any of the password flags, and click Next.
Click Finish.
> dsadd user "<UserDN>" -upn <UserUPN> -fn "<UserFirstName>" -ln "<UserLastName>"[RETURN] -display "<UserDisplayName>" -pwd <UserPasswd>
' Taken from ADS_USER_FLAG_ENUM
Const ADS_UF_NORMAL_ACCOUNT = 512
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.Put "userAccountControl", ADS_UF_NORMAL_ACCOUNT
objUser.SetInfo
objUser.SetPassword("<Password>")
objUser.AccountDisabled = FALSE
objUser.SetInfoThe only mandatory attribute that ...