0 votes

I have tried it using the Custom Commands Action "Add the user to a group", which only allows me to add the user to one group at a time, and can't use the multiple DNs that the object picker parameter provides.

Next I tried a powershell script:

$groupsParam = %param-gruppen% # TODO: modify me
$groupsParamSeparator = ";" # TODO: modify me

$groups = $Context.GetParameterValue($groupsParam)
foreach ($dn in $groups.Split($groupsParamSeparator))

But I can't get it to work. Could you assist me in finding the best way to do this?

by (160 points)

1 Answer

0 votes
by (272k points)
selected by
Best answer

Hello Dominik,

You can use the below script in a custom command configured for the User object type. In the script:

  • $groupsParam – Specifies the name of the parameter that will be used to select groups. The name must include the param- prefix
  • $groupsParamSeparator – Specifies the separator enter for multiple values in the parameter settings. Make sure not to use English characters or comma as they are always present in object DNs and will not work as separator. image.png
  • $pipelined – If set to false, adding to groups will be performed directly in AD and Adaxes workflows will not trigger. Also, there will be no log records for group updates in Adaxes.
$groupsParam = "param-gruppen" # TODO: modify me
$groupsParamSeparator = ";" # TODO: modify me
$pipelined = $True # TODO: modify me

# Get parameter value
$groupDNs = $Context.GetParameterValue($groupsParam)

foreach ($groupDN in $groupDNs.Split($groupsParamSeparator))
    # Bind to the group
    $group = $Context.BindToObjectByDNEx($groupDN, $pipelined)

    # Add target user to group

This has worked perfectly, thanks so much for responding so fast!

Related questions

0 votes
1 answer

Occationally Service Desk staff need to clear a DNS record when a desktop has been reimaged but is keeping the same name as loses the ability to manage its original DNS ... running in ADAXES. Can I just install the applet on the ADAXES server using powershell?

asked Jan 17, 2023 by stevehalvorson (110 points)
0 votes
1 answer

Here is my issue, When I use this code: $DNs = %param-GroupsInRole% $Groups = $DNs -split "|" %Param-GroupsInRole% can have multiple groups. When setting up the parameter I am ... I just need to be able to do a foreach with the groups picked by the initiator.

asked Mar 23, 2023 by mightycabal (1.0k points)
0 votes
1 answer

I would like to add a parameter for country to a custom command. Since the country has to be entered correctly in order for Active Directory to accept it, I would like to ... ? I didn't find it in the documentation and the sample scripts didn't use parameters.

asked Jun 4, 2020 by mark.it.admin (2.3k points)
0 votes
1 answer

We are replacing our Namescape rDirectory product with Adaxes because of the very flexible automation components. I've been able to replicate some of the pages previously ... vast majority of our users, that would function as the default company directory.

asked Aug 5, 2022 by MRBruce (110 points)
0 votes
0 answers

usually we have to set up users account with access to many share mailbox. However, the time consuption adding those emails one by one it is too much as we needs to sep up many users in one day and that task can take from 10 minutes to an hour.

asked Apr 29, 2021 by Sandovis (20 points)
3,346 questions
3,047 answers
544,982 users