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.

Script Repository

Check whether object is moved to specific OU

February 25, 2021 Views: 1110

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
Leave a comment
Loading...

Got questions?

Support Questions & Answers