Script repository
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$trueto pass the update through Adaxes pipeline to create log records, apply business rules, security roles, etc. Set to$falseto 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.