Script repository

Check if object in specific property is member of business unit

Updated on: Jan 18, 2026, Views: 951

Business units

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 - 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 - the schema name of the property storing the object to check business unit membership for.
$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

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.