Script repository

Request approval for adding to a group from owner of the member OU

Updated on: Jan 18, 2026, Views: 4198

Approval requests

The script submits the request to add an object to a group for approval. The owner of the OU where the object is located will be set as approver. To execute the script, create a business rule triggering Before adding a member to a group.

# Bind to the OU where the member is located.
$member = $Context.BindToObject("Adaxes://%member%")
$parent = $Context.BindToObject($member.Parent)

try
{
    # Get OU owner DN.
    $approverDN = $parent.Get("managedBy")
}
catch
{
    $Context.Cancel("Cannot add the object to the group because the Organizational Unit where he is located doesn't have an owner") # TODO: modify me
    return
}

# Submit for approval.
$Context.SubmitForApproval(@($approverDN), $False, $False, $False, $False)

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.