Hello,
Thank you for the provided details. As we mentioned in the previous posts, you will need to use a Business Rule triggering After updating a computer. The rule will look like the following:
The Business Rule will execute the following script:
# Build distinguished name of target OU
$ownerDn = New-Object "Softerra.Adaxes.LDAP.DN" "%managedBy%"
$ownerParentOu = $ownerDn.Parent
$targetOuDn = "OU=Workstations," + $ownerParentOu
# Bind to the target OU
try
{
$targetOu = $Context.BindToObjectByDNEx($targetOuDn, $True)
}
catch
{
$Context.LogMessage("Workstations OU does not exist for computer %name%.", "Error")
return
}
# Move computer
$targetOu.MoveHere($Context.TargetObject.AdsPath, $NULL)
If you need to make sure that the computers are always located in the corresponding OUs and bring them back in case of mistakes, you can use a Scheduled Task like the following. In the task, you will need to create an Else If block for each of the computer locations/departments you have.