The script returns true if an object is moved to the specified Organizational Unit or container. it can be used in the If PowerShell script returns true condition of a business rule triggering before moving an object.
Parameters:
- $containerDN - Specifies the distinguished name (DN) that should match the target container DN for the condition to be met.
PowerShell
$containerDN = "OU=Disabled Accounts,DC=company,DC=com" # TODO: modify me
# Get target container DN
$targetContainer = $Context.Action.TargetContainer
if ($targetContainer)
{
$targetContainerDN = $targetContainer.Get("distinguishedName")
}
else
{
$targetContainerDN = $Context.Action.TargetContainerDnTemplate
}
$Context.ConditionIsMet = $targetContainerDN -eq $containerDN