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.

Script Repository

Add group members from DN syntax property

September 07, 2023 Views: 1281

The script adds objects stored in a DN syntax property (e.g. See Also) of the target object to the specified group. To execute the script, create a custom command, business rule or scheduled task configured for the Group object type.


  • $groupDnTemplate - Specifies the distinguished name (DN) of the group to add members to. For information on how to get the DN, see Get the DN of a directory object.
  • $attributeName - Specifies the LDAP name of the DN syntax property to get members from.
Edit Remove
$groupDnTemplate = "CN=My Group,OU=Groups,DC=domain,DC=com" # TODO: modify me
$attributeName = "seeAlso" # TODO: modify me

# Get attribute value
    $memberDNs = $Context.TargetObject.GetEx($attributeName)
    $Context.LogMessage("Property '$attributeName' is not specified for user %fullname%.", "Information")

# Add members to the group
$group = $Context.BindToObjectByDN($groupDnTemplate)
foreach ($memberDN in $memberDNs)

# Clear the attribute
$Context.TargetObject.Put($attributeName, $NULL)
Comments 0
Leave a comment

Got questions?

Support Questions & Answers