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

Check if object in specific property is member of business unit

June 13, 2024 Views: 53

The script returns true if the object stored in the specified property is a member of the specified business unit. To execute the script, use the If PowerShell script returns true condition in a custom command, business rule or scheduled task.

Parameters:

  • $businessUnitDN - Specifies the distinguished name (DN) of the business unit to check. For details on how to get an object DN, see https://adaxes.com/sdk/HowDoI.GetDnOfObject/.
  • $propertyName - Specifies the schema name of the property storing the object to check business unit membership for.
Edit Remove
PowerShell
$businessUnitDN = "CN=My Unit,CN=Business Units,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
$propertyName = "manager" # TODO: modify me

$Context.ConditionIsMet = $False

# Get ADS Path of the object to check
try
{
    $objectDN = $Context.TargetObject.Get($propertyName)
    $object = $Context.BindToObjectByDN($objectDN)    
}
catch
{
    return
}

# Bind to the business unit
$businessUnit = $Context.BindToObjectByDNEx($businessUnitDN, $True)

# Check business unit membership
$Context.ConditionIsMet = $businessUnit.IsMember($object)
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers