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

Disable accounts specified in DN syntax property

May 04, 2023 Views: 379

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).
Edit Remove
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()
}
Comments 0
Leave a comment
Loading...

Got questions?

Support Questions & Answers