The script disables all computers managed by a user. You can use it as a part of the user deprovisioning process. For information onhow to add it to the built-in Deprovision custom command, see Configure User Deprovisioning.
To use it as a part of a business rule, scheduled task, or custom command, you need to add the Run a program or PowerShell script action that executes the script.
Note: The script uses cmdlets from Adaxes PowerShell module for Active Directory. To run it, you need to install the PowerShell Module for Active Directory component of Adaxes.
PowerShell
Import-Module Adaxes
$computers = Get-AdmComputer -LdapFilter "(managedBy=%distinguishedName%)"
if ($computers -eq $NULL)
{
return
}
$computers | Disable-AdmAccount