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

Copy multi-valued property values

November 29, 2022 Views: 561

The script replaces values of a multi-valued property for the specified object with the values of the target object. To execute the script, create a custom command, business rule or scheduled task.

Parameters:

  • $propertyName - Specifies the name of the property to process as it is specified in the directory schema.
  • $targetObjectDN - Specifies the distinguished name (DN) of the object to update. For information on how to get an object DN, see https://www.adaxes.com/sdk/HowDoI.GetDnOfObject/.
  • $pipelined - Specifies whether to pass the updates made by the script through the Adaxes pipeline to trigger business rules, apply property patterns, etc.
Edit Remove
PowerShell
$propertyName = "adm-ManagedByList" # TODO: modify me
$targetObjectDN = "CN=My group,OU=Groups,DC=company,DC=com" # TODO: modify me
$pipelined = $True # TODO: modify me

# Get property value
try
{
    $propertyValue = $Context.TargetObject.GetEx($propertyName)
}
catch
{
    $Context.LogMessage("Proeprty $propertyName is empty.", "Information")
    return
}

# Update object
$object = $Context.BindToObjectByDNEx($targetObjectDN, $pipelined)
$object.Put($propertyName, $propertyValue)
$object.SetInfo()
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers