Script repository

Add members from parameter to target group

Updated on: Jan 18, 2026, Views: 4603

Group membership

The script adds members selected in a custom command parameter to the target group. To execute the script, create a custom command configured for the Group object type.

Parameters

  • $membersParameterName - the name of the Directory object picker parameter used to select members. The parameter name must be specified with the param- prefix.
  • $separator – a separator (e.g. semicolon) for members in the parameter.
  • $pipelined - set to $true to add members to the group through Adaxes pipeline to create log records, apply business rules, security roles, etc. Set to $false to perform group membership update directly in AD (Adaxes functionality will not be applied).
$membersParameterName = "param-Members" # TODO: modify me
$separator = ";" # TODO: modify me
$pipelined = $True # TODO: modify me

# Bind to the target group.
$group = $Context.BindToObjectByDNEx("%distinguishedName%", $pipelined)

# Get parameter value.
$membersToAdd = $Context.GetParameterValue($membersParameterName)

# Update the group membership.
foreach ($memberDn in $membersToAdd.Split($separator))
{
    if(-not $group.IsMember("Adaxes://$memberDn"))
    {
        $group.Add("Adaxes://$memberDn")
    }
}

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    We use cookies to improve your experience.
    By your continued use of this site you accept such use.
    For more details please see our privacy policy and cookies policy.