Script repository
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.