Script Repository


Check whether object is moved to specific OU

February 25, 2021
401

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.
Edit Remove
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

Comments ( 0 )
No results found.
Leave a comment