Skip to content

Executing Custom Commands

The following code sample executes a Custom Command on a user account.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=company,DC=com"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Execute Custom Command
$commandID = "{9DB88EC3-1241-4AB1-9612-C7C982BAA49F}" # Deprovision
$user.ExecuteCustomCommand($commandID)

Tip

For information on how to get the ID of a Custom Command, see Get the ID of a Custom Command.

See also