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.
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)