Create Multiple AD Objects in One Operation


Using Adaxes it is possible to create Active Directory objects from within Business Rules, Custom Commands and Scheduled Tasks. In this tutorial you'll learn how to create a Custom Command that will create an Organizational Unit with the name specified by the user, and then create a user account and a group in the new OU.

The Custom Command will also perform the following actions:

  • Add the new user to the new group.
  • Set the user who initiated the operation as the owner of the new Organizational Unit.
  • Handle the case where another Organizational Unit with the same name already exists.

  1. Launch Adaxes Administration Console, expand your Adaxes service, right-click Custom Commands, point to New and click Custom Command.


  2. Enter a name for the new Custom Command, select an icon and provide description.


    Since the Custom Command will prompt for user input, it is recommended to disable the confirmation popup. To do it, uncheck the Confirmation checkbox.

    Click Next.

  3. Because the command will create objects under the Organizational Unit selected by the user, it needs to be executed on Organizational Unit objects. Select the Organizational Unit object type.



    Click Next.

  4. Now we need to add a parameter to the Custom Command to let users specify the name of the new Organizational Unit.


    • Click New.

    • Select Edit box and click Next.

    • Enter the parameter name and display name. Click Next.

    • Configure options for the parameter and click Finish.

    When done, click Next.

  5. To add an action that will create an Organizational Unit:


    • Click Add an action.

    • In the Add Action dialog, select the Create an Active Directory object action.

    • Select Organizational Unit in the Type drop-down list.

    • In the Location field, specify where a new Organizational Unit will be created.

      If you set the location to %distinguishedName%, the value reference will be replaced with the DN of the Organizational Unit on which the Custom Command is executed, and the new OU will be created under the selected one.

    • To set the name of the Organizational Unit to the value of the Custom Command parameter:


      • Right-click the Organizational Unit Name property and select Edit in the context menu.

      • Click the button.

      • Select the Custom Command parameter in the list.

      • Click OK two times.

    • To set the user who executed the Custom Command as the owner of the new Organizational Unit:


      • Click Add and select the Managed By property.

      • Click the button.

      • Activate the Template tab and click the button.

      • Select the InitiatorDN property in the list.

      • Click OK three times.

      • If necessary, provide values for other properties of the Organizational Unit.

        When done, click OK.

  6. To add an action that will create a user account in the new Organizational Unit:


    • Right-click the set of actions and select Add Action in the context menu.

    • In the Add Action dialog, select the Create an Active Directory object action.

    • Select User in the Type drop-down list.

    • In the Location field, specify where a new user account will be created. To create it in the Organizational Unit created by this Custom Command, use the following template:

      OU=%param-OrganizationName%,%distinguishedName%

      The %param-OrganizationName% value reference will be replaced with the value of the Custom Command's parameter, and the %distinguishedName% value reference will be replaced with the DN of the Organizational Unit on which the Custom Command is executed.

    • Modify the values of the Full Name and Logon Name properties.

      For example, you can set the properties to the following values:

      Full Name: %param-OrganizationName% Admin
      Logon Name: %param-OrganizationName:lower%_admin
      

      The %param-OrganizationName% value reference will be replaced with the value of the Custom Command's parameter. If the parameter set to Acme, the property values will be as follows:

      Full Name: Acme Admin
      Logon Name: acme_admin
      
    • If necessary, provide values for other properties of the user account. When done, click OK.

  7. To add an action that will create a group:


    • Right-click the set of actions and select Add Action in the context menu.

    • In the Add Action dialog, select the Create an Active Directory object action.

    • Select Group in the Type drop-down list.

    • In the Location field, specify where a new group object will be created. To create it in the Organizational Unit created by this Custom Command, use the following template:

      OU=%param-OrganizationName%,%distinguishedName%

      The %param-OrganizationName% value reference will be replaced with the value of the Custom Command's parameter, and the %distinguishedName% value reference will be replaced with the DN of the Organizational Unit on which the Custom Command is executed.

    • Modify the values of the Group Name and Group Name (pre-Windows 2000) properties.

      For example, if you set the properties to %param-OrganizationName%, the name of the group will set to the value of the Custom Command's parameter and thus will be the same as the name of the Organizational Unit.

    • To add the user account created by this Custom Command to the new group:


      • Click Add and select the Member property.

      • Click the button.

      • Activate the Template tab.

      • In the Template field, specify a template to be used to generate the DN of the user.

        To build a template, use the value of the Full Name property you specified for the user account. For example, if the Full Name property was set to %param-OrganizationName% Admin, the template should look like this:

        CN=%param-OrganizationName% Admin,OU=%param-OrganizationName%,%distinguishedName%
        
      • Click OK two times.

    • If necessary, provide values for other properties of the group object. When done, click OK.

  8. To cancel command execution if an Organizational Unit with the same name already exists, do the following:


    • Click Add new action set.

    • Right-click the new set and select Add Action in the context menu.

    • In the Add Action dialog, select the Cancel this operation action.

    • In the Reason field, type the text of the error message.

    • Click OK.
    • Right-click the new action and select Add Condition in the context menu.

    • In the Add Condition dialog, select the If <object> exists condition.

    • In the Condition Parameters section, specify a template for the DN of the Organizational Unit created by this Custom Command.

      To build a template, use the value of the Organizational Unit Name property that you specified for the Organizational Unit. If the property was set to %param-OrganizationName%, the template should look like this:

      OU=%param-OrganizationName%,%distinguishedName%
      
    • Click OK.

    • To perform the check before creating objects, select the action set and click the   button to move it up.

      To move the whole set, make sure no actions and conditions are selected.

    Click Next.

  9. To execute Custom Commands, users must have appropriate permissions. At this step of the wizard, you can select the Security Roles to which you want to add the permission to execute the new Custom Command.


    You can skip this step and configure the permissions later. For details, see Grant Rights to Execute Custom Commands.



    Click Finish.

For instructions on how to place a Custom Command on the Actions pane in the Web Interface, see Configure Actions Pane.

For instructions on how to disable a Custom Command in the Web Interface, see Disable Operations on AD objects.



Open tutorial filtering

Got questions?
Support Forum