Script repository
The script adds the target account to the groups selected in a custom command parameter. To execute the script, create a custom command configured for the required object type.
Parameters
$groupsParameterName- the name of the Directory object picker parameter used to select groups. The parameter name must be specified with the param- prefix.$separator– a separator (e.g. semicolon) for groups in the parameter.$pipelined- set to$trueto add the target object to the groups through Adaxes pipeline to create log records, apply business rules, security roles, etc. Set to$falseto perform group membership update directly in AD (Adaxes functionality will not be applied).
$groupsParameterName = "param-Groups" # TODO: modify me
$separator = ";" # TODO: modify me
$pipelined = $True # TODO: modify me
# Get parameter value.
$groupsToAdd = $Context.GetParameterValue($groupsParameterName)
# Update the group membership.
foreach ($groupDn in $groupsToAdd.Split($separator))
{
$group = $Context.BindToObjectByDNEx($groupDn, $pipelined)
if(-not $group.IsMember($Context.TargetObject.AdsPath))
{
$group.Add($Context.TargetObject.AdsPath)
}
}
Comments 0
You must be signed in to comment.