Automatically Move Users between Organizational Units


You can configure Adaxes to automatically move objects between Organizational Units based on certain rules. For example, when a new user account is created in Active Directory, Adaxes can automatically move the account to the Organizational Unit that corresponds to the user's city. When the City property of a user account is changed, Adaxes can move the account to the OU associated with the new city. To ensure that all Active Directory objects are always placed into appropriate OUs, you can use Scheduled Tasks to move objects on a periodic basis.

To share the move object rules between different Business Rules and Scheduled Tasks, you can create a Custom Command that will contain all the necessary actions and conditions, and then execute the command in Business Rules and Scheduled Tasks.

In this tutorial, you will learn how to create a Custom Command that will move users between OUs based on their city, and how to execute the command in Business Rules and Scheduled Tasks.


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



    Enter a name for the new Custom Command.

  2. Since the Custom Command will be executed by Business Rules and Scheduled Tasks only, uncheck the Enabled checkbox. Disabled commands are not displayed in the user interface.


    Click Next.

  3. Since the Custom Command will move user accounts, select the User object type and click Next.


  4. On the Parameters step click Next.


  5. On the Actions step click Add an action.



    Select the Move the User action.



    In the Action Parameters section, select the Organizational Unit that corresponds to one of the cities.



    Click OK.

  6. Right-click the newly added action and select Add Condition in the context menu.



    Select the If <property> <relation> <value> condition.



    In the Condition Parameters section specify City - equals - <City Name>.



    Click OK.

  7. Right-click the condition/action block and select Copy in the context menu. To copy the whole block, make sure no actions and conditions are selected.



    Right-click the condition/action block again and select Paste in the context menu.



    Double-click the action and condition in the pasted Else If block and configure them for another city.


    Repeat the steps above for each city.


    To move an Else If block up and down, select it, and use the     buttons. To move the whole block, make sure no actions and conditions are selected.

    Optionally, add Else block to move users to a specific Organizational Unit if none of the conditions are met.



    Using Templates

    With the help of templates, you can create a single action that will move users to different OUs based on user account properties. For this purpose, you need to provide a template that will be used to build the distinguished name (DN) of the target Organizational Unit. For example, to move users to the Organizational Unit that has the same name as the user's city, you can use the following template:

    OU=%l%,DC=example,DC=com

    Value reference %l% will be replaced with the value of the City property of user accounts. For example, if the City property of a user account is set to New York, the account will be moved to Organizational Unit OU=New York,DC=example,DC=com.


    • Click Add an action.


    • Select the Move the User action.


    • In the Action Parameters section, click the button.


    • Activate the Template tab.


    • In the Template field, specify a template for the distinguished name of the target Organizational Unit.

      To insert a value reference, click the button.

      For more examples, click the View Examples link.


    • Click OK.
  8. When done, click Next. On the Permissions page, click Finish.


  9. Select a Business Rule or a Scheduled Task that will execute the Custom Command.


    To execute the Custom Command after a new user account is created, you can use built-in Business Rule After User Creation. For details on how to configure and activate the rule, see Automate User Provisioning.

    For instructions on how to create a Scheduled Task, see Schedule Tasks for AD Management.

  10. Click Add new action set.


    Right-click Do nothing and select Add Action in the context menu.


    In the Add Action dialog, select Execute a Custom Command.


    In the Action Parameters section, select the Custom Command.


    Click OK.

  11. If the Custom Command is executed in a Business Rule triggered after updating a user, add the If the City property has changed condition.



    Add the Custom Command to other Business Rules and Scheduled Tasks.






To make City a required field and allow users to select a city from a drop-down list, you can use Property Patterns.

  • Select built-in Property Pattern User Pattern.

  • In the section located to the right, click Add and select City in the drop-down list.

  • Check the The property is required checkbox.

  • Select Must be one of the following values only and click Edit to specify the list of allowed cities.

  • Click OK and then click Save changes.



See Also




Open tutorial filtering

Got questions?
Support Forum