Script Repository

Check whether object is moved to specific OU

February 25, 2021

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.


  • $containerDN - Specifies the distinguished name (DN) that should match the target container DN for the condition to be met.
Edit Remove
$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")
    $targetContainerDN = $Context.Action.TargetContainerDnTemplate

$Context.ConditionIsMet = $targetContainerDN -eq $containerDN

Comments ( 0 )
No results found.
Leave a comment