Create User operation


The Create User operation creates a new user account.

The following table describes the elements for the <items> XML element and adapter request for the Create User operation:

 Elements for the <items> XML element and adapter request for the Create User operation

Element

Definition

Required

<target>

Specifies the target for the request

If this element is not present, the adapter uses the default target specified in its configuration.

No

<host>

Specifies the host name or IP address of the remote computer

To specify a dynamic target, you must use this element.

No

<user-name>

Specifies the user name for remote host authentication

To specify a dynamic target, you must use this element.

No

<password>

Specifies the password that corresponds to the user name

To specify a dynamic target, you must use this element.

No

<commands>

Indicates the beginning of the <commands> element, which contains the individual <command> elements

Yes

<command>

Indicates the beginning of a <command> element, which contains the elements that specify the operation to execute and its parameters

Yes

<active-directory-command>

Specifies the operation to execute

Default value: Create

Yes

<object-class>

Specifies the type of object on which to perform the operation

Default value: User

Yes

<object-distinguished-name>

Specifies the distinguished name of the object

Yes

<parameters>

Contains the element list for the operation

No

<sam-account-name>

Specifies the unique Security Account Manager (SAM) account name for the computer

No

<description>

Specifies the description of the user to be added

No

<user-principal-name>

Specifies the user principal name of the user

No

<first-name>

Specifies the first name of the user

No

<middle-initial>

Specifies the middle initial of the user

No

<last-name>

Specifies the last name of the user

No

<display-name>

Specifies the display name of the user

No

<employee-id>

Specifies the employee ID of the user

No

<user-password>

Specifies the password for the user, set to password

No

<office-location>

Specifies the office location of the user

No

<phone-number>

Specifies the telephone number of the user

No

<email>

Specifies the e-mail address of the user

No

<home-phone-number

Specifies the home phone number of the user

No

<pager-number>

Specifies the pager number of the user

No

<cell-phone-number>

Specifies the cell phone number of the user

No

<fax-number>

Specifies the fax number of the user

No

<web-page-url>

Specifies the web page URL of the user

No

<title>

Specifies the title of the user

No

<department>

Specifies the department of the user

No

<company>

Specifies the company of the user

No

<manager-distinguished-name>

Specifies the distinguished name of user's manager

No

<home-directory-location>

Specifies the home directory of the user

The home directory path is a Universal Naming Convention (UNC) path, you must also use the <homedirectory-drive-letter> element to specify a drive letter to map to this path.

No

<profile-path>

Specifies the path to the user's profile

No

<logon-script-path>

Specifies the path to the user's logon script

No

<must-change-password>

Specifies whether the user must change passwords at the next logon; default is no

No

<can-change-password>

Specifies whether the user can change the password; default is yes

You must set this element to yes if the value of must-change-password is yes.

No

<reversible-encryption-password>

Specifies whether the user password is stored using reversible encryption; default is no

No

<password-never-expires>

Specifies whether the user password expires; default is no

No

<account-expires>

Specifies the number of days until the user account expires

  • A value of 0 sets the expiry at the end of today
  • A positive value sets the expiry to a future date
  • A negative value sets expiry to a past date
  • The value never will not allow an account to expire

    For example, a value of 0 implies that the account expires at the end of today. A value of -5 implies that the account expired 5 days ago and sets an expiry date in the past. A value of 5 sets the account expiration date for 5 days ahead of the current day.

No

<disabled>

Specifies whether the user account is enabled for log on

No

<member-of>

Specifies the distinguished names of the groups of which the user will be a member.

No

<server>

Specifies the remote server for the connection

If the object belongs to an Active Directory service hosted on a remote server, you must use this element.

Conditional

<domain>

Specifies the remote domain for the connection

If the object belongs to an Active Directory service hosted on a remote server, you must use this element.

Conditional

<user-name>

Specifies the logon user name for the remote server

Conditional

<password>

Specifies the password associated with the user name

Conditional

The following figure shows a sample adapter request for the Create User operation:

Adapter request for the Create User operation

<active-directory-request>
 <target>
   <host>vm-w23-rds19</host>
   <user-name>administrator</user-name>
   <password>bmcAdm1n</password>
 </target>
 <commands>
   <command>
     <active-directory-command>Create</active-directory-command>
     <object-class>User</object-class>
     <object-distinguished-name>CN=rohitn-pun-01,
  CN=Users,DC=vm-w23-rds19,DC=local</object-distinguished-name>
    <parameters>
      <sam-account-name>ROHITN-PUN-01$</sam-account-name>
      <description>This is a test user account</description>
      <user-principal-name>rohitn@adprod.bmc.com</user-principal-name>
      <first-name>Rohit</first-name>
      <middle-initial>A</middle-initial>
      <last-name>Nayar</last-name>
      <display-name>Rohit Nayar</display-name>
      <employee-id>30712</employee-id>
      <user-password>Password1#</user-password>
      <office-location>Pune</office-location>
      <phone-number>+91-020-39875226</phone-number>
      <email>rohit_nayar@bmc.com</email>
      <home-phone-number>+91-022-28115111</home-phone-number>
      <pager-number>+91-9852314780</pager-number>
      <cell-phone-number>+91-9960906919</cell-phone-number>
      <fax-number>+91-020-39875001</fax-number>
      <web-page-url>http://bmcindia.com/rohitn</web-page-url>
      <title>Staff Product Developer</title>
      <department>Research and Development</department>
      <company>BMC Software</company>
      <manager-distinguished-name>CN=kwatkins,
   CN=Users,DC=vm-w23-rds19,DC=local</manager-distinguished-name>
      <home-directory-location>\Documents and Settings\rnayar
      </home-directory-location>
      <home-directory-drive-letter>C:</home-directory-drive-letter>
      <profile-path>C:\Documents and Settings\rnayar</profile-path>
      <logon-script-path>C:\Documents and Settings\rnayar</logon-script-path>
      <must-change-password>no</must-change-password>
      <can-change-password>yes</can-change-password>
      <reversible-encryption-password>yes</reversible-encryption-password>
      <password-never-expires>no</password-never-expires>
      <account-expires>0</account-expires>
      <disabled>no</disabled>
      <member-of>CN=Test-Group-1,DC=vm-w23-rds19,DC=local</member-of>
      <server>vm-w23-rds19</server>
      <user-name>administrator</user-name>
      <password>bmcAdm1n</password>
     </parameters>
   </command>
 </commands>
</active-directory-request>


The following figure shows a sample adapter response for the Create User operation:

Sample adapter response for the Create User operation

<active-directory-response>
 <metadata>
   <status>success</status>
 </metadata>
 <target-output host="vm-w23-rds19">
   <metadata>
     <os-id>Windows 2003</os-id>
     <os-version>5.2 Build 3790 Service Pack 2</os-version>
     <status>success</status>
   </metadata>
   <commands-output>
     <command-output>
       <metadata>
         <command>dsadd user "CN=rohitn-pun-01,CN=Users,
DC=vm-w23-rds19,DC=local" -samid "JOHNS-OHIO-01$" 
-desc "This is a test user account" -upn "johns@asdf.abc.com"
-fn "John" -mi "A" -ln "Smith" -display "John Smith" -empid "30712"
-pwd "Password1#" -office "ohio" -tel "+91-020-39875226"
-email "john_smith@abc.com" -hometel "+91-022-28115111"
-pager "+91-9852314780" -mobile "+91-9960906919"
-fax "+91-020-39875001" -webpg "http://bmcindia.com/johns"
-title "Staff Product Developer" -dept "Research and Development"
-company "BMC Software" -mgr "CN=kwatkins,CN=Users,DC=vm-w23-rds19,
DC=local" -hmdir "\Documents and Settings\jsmith" -hmdrv "C:" -profile 
"C:\Documents and Settings\jsnith" -loscr
"C:\Documents and Settings\rnayar" -mustchpwd "no" -canchpwd "yes"
-reversiblepwd "yes" -pwdneverexpires "no"
-acctexpires "0" -disabled "no" -memberof
"CN=Test-Group-1,DC=vm-w23-rds19,DC=local" -s "vm-w23-rds19"
-u "administrator" -p "bmcAdm1n"</command>
         <line-count>6</line-count>
         <execution-milliseconds>2172</execution-milliseconds>
         <exit-code>0</exit-code>
         <status>success</status>
       </metadata>
       <output>
         <line index="1">Attempting to connect to remote host...</line>
         <line index="2">Initialising rctrlx server component...</line>
         <line index="3">Executing remote application: cmd /c dsadd user
"CN=johns-ohio-01,CN=Users,DC=vm-w23-rds19,
DC=local" -samid "JOHNS-OHI-01$" -desc "This is a test user account" 
-upn "rohitn@adprod.bmc.com" -fn "Rohit" -mi "A" -ln "Smith"
-display "John Smith" -empid "30712"
-pwd "Password1#" -office "ohio" -tel "+91-020-39875226"
-email "rjohn_smith@abc.com" -hometel "+91-022-28115111"
-pager "+91-9852314780" -mobile "+91-9960906919"
-fax "+91-020-39875001" -webpg "http://bmcindia.com/rohitn"
-title "Staff Product Developer" -dept "Research and Development"
-company "BMC Software" -mgr "CN=kwatkins,CN=Users,
DC=vm-w23-rds19,DC=local" -hmdir "\Documents and Settings\rnayar" 
-hmdrv "C:" -profile "C:\Documents and Settings\rnayar" -loscr
"C:\Documents and Settings\jsmith" -mustchpwd "no" -canchpwd "yes"
-reversiblepwd "yes" -pwdneverexpires "no" -acctexpires "0"
-disabled "no" -memberof "CN=Test-Group-1,DC=vm-w23-rds19,
DC=local" -s "vm-w23-rds19" -u "administrator" -p "bmcAdm1n"</line>
         <line index="4">Remote application process ID: 6400</line>
         <line index="5">dsadd succeeded:CN=rohitn-pun-01,CN=Users,
   DC=vm-w23-rds19,DC=local</line>
         <line index="6">Remote application exited with code: 0</line>
       </output>
     </command-output>
   </commands-output>
 </target-output>
</active-directory-response>

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*