The script disables the accounts specified in a DN syntax property of the target object. The script can be executed in business rules, custom commands and scheduled tasks.
Parameters:
- $propertyName - Specifies the directory schema name of the property to obtain accounts for disabling from.
- $pipelined - If set to $True, disabling the accounts will be passed through Adaxes pipeline to apply configured workflows (e.g. trigger corresponding business rules, create a log record in Adaxes for each update).
PowerShell
$propertyName = "seeAlso" # TODO: modify me
$pipelined = $True # TODO: modify me
# Get property values
try
{
$DNs = $Context.TargetObject.GetEx($propertyName)
}
catch
{
$Context.LogMessage("<TEXT>", "Information")
}
# Disable accounts
foreach ($DN in $DNs)
{
$account = $Context.BindToObjectByDNEx($DN, $pipelined)
$account.AccountDisabled = $True
$account.SetInfo()
}