Deprovisioning user accounts
The following code sample executes the built-in custom command Deprovision for a user account.
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
# Connect to the Adaxes service
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")
# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=company,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)
# Execute custom command
$commandID = "{9DB88EC3-1241-4AB1-9612-C7C982BAA49F}" # Deprovision
$user.ExecuteCustomCommand($commandID, $null)
For information on how to get the identifier of a custom command, see Get custom command identifier.