Create custom command

With the help of custom commands, users can perform multi-step operations in one action. For example, a command can be used to perform all tasks associated with sending a user n vacation – add the user to a specific group, send an email notification to the user's manager, set an out-of-office reply, disable the account, etc.

Users can execute custom commands just like other operations in the web interface and administration console.

In this tutorial, you will learn how to create and configure a custom command.

  1. Launch Adaxes administration console.

     How
    • On the computer where Adaxes administration console is installed, open Windows Start menu.

    • Click Adaxes Administration Console.

  2. Right-click your Adaxes service, point to New and click Custom Command.

  3. Enter a name for the new custom command, select an icon, provide a description and the confirmation text.

    Optionally, clear the Enabled checkbox to create the command in a disabled state. Disabled custom commands are not displayed in the user interface but can be executed by business rules, scheduled tasks, and other custom commands.

    Click Next.

  4. Select the type of objects that can be targeted by the command.

    Click Next.

  5. On the Parameters step, you can add parameters. Parameters enable you to ask users executing the command for input and process the entered values in the command.

     How to use parameters { #how_to_use_parameters}

    To perform different actions based on parameter values, you can use the If <parameter> <value> condition:

    Parameter values can also be used in other actions and conditions with the help of value references.

    It is also possible to use parameter values in PowerShell scripts. For instance, you can set a script variable to a parameter value like so:

    $var = "%param-MyParam%"
    
    # Alternatively, you can use the GetParameterValue method of the $Context variable
    $var = $Context.GetParameterValue("param-MyParam")
    
    # If you need to prevent value conversion to string, use the GetParameterValueAsIs method
    # The $date variable is set to a System.DateTime object
    $date = $Context.Arguments.GetParameterValueAsIs("param-ParamDate")
    

    When done, click Next.

  6. Click Add an action.

  7. Select the action you need, and configure action parameters and execution options.

    Requesting approval

    To request approval for the command execution, select the Send this operation for approval action. In the following example, approval is requested if the initiator is not a member of the Administrators group.

    Actions are executed in order, from top to bottom. This means you can strategically place the Send this operation for approval action in the middle of an action set to request approval only for the actions that follow.

    Cancelling execution

    To cancel the execution of the custom command, select the Cancel this operation action. In the following example, command execution is cancelled if the account of the user is disabled.

    When done, click OK.

  8. To add more actions to the command, right-click an action set and click Add Action in the context menu.

    Actions are executed in order, from top to bottom. To move an action up and down, select it and use the arrow buttons.

  9. To execute actions only if certain conditions are met, right-click the action set, and click Add Condition in the context menu.

    If there are two or more conditions, they are combined by the AND/OR operator. To change the operator, click it.

    • The AND operator means the actions are executed if all conditions are met.
    • The OR operator means the actions are executed if at least one condition is met.

    Else If and Else blocks

    You can use Else If and Else blocks to avoid duplication of conditions for different sets of related but mutually exclusive actions.

    The Else block is useful when you need to perform specific actions when conditions are met and generic actions in other cases.

    To add Else If and Else blocks to an action set, right-click it and then click Add Else or Add Else If in the context menu.

  10. To perform different actions for different conditions, you need to add a separate action set and then assign the necessary conditions to it. To add an action set, click Add new action set.

    Action sets are executed in order, from top to bottom. To change the order, select an action set and move it with the arrow buttons. Make sure no actions or conditions are selected to move the entire set.

    When done, click Next.

  11. On the Permissions step, select the security roles where 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.

Additional information