Script repository

Disable accounts specified in DN syntax property

Updated on: Jan 18, 2026, Views: 2140

Miscellaneous

The script disables the accounts specified in a DN syntax property of the target object. To execute the script, create a business rule, custom command or scheduled task configured for the required object type.

Parameters

  • $propertyName - the directory schema name of the property to obtain accounts for disabling from.
  • $pipelined - set to $true to pass the update through Adaxes pipeline to create log records, apply business rules, security roles, etc. Set to $false to perform the update directly in AD (Adaxes functionality will not be applied).
$propertyName = "seeAlso" # TODO: modify me
$pipelined = $True # TODO: modify me

# Get property values
try
{
    $DNs = $Context.TargetObject.GetEx($propertyName)
}
catch
{
    $Context.LogMessage("Property $propertyName is empty.", "Information")
    return
}

# Disable accounts
foreach ($DN in $DNs)
{
    $account = $Context.BindToObjectByDNEx($DN, $pipelined)
    $account.AccountDisabled = $True
    $account.SetInfo()
}

Comments 0

You must be signed in to comment.

    Got questions?

    Support Questions & Answers

    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.