Deleting custom commands

The following code sample deletes a custom command.

[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 custom command
$customCommandsPath = $service.Backend.GetConfigurationContainerPath("CustomCommands")
$customCommandsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" $customCommandsPath
$myCustomCommandAdsPath = $customCommandsPathObj.CreateChildPath("CN=My Command")

$myCustomCommand = $service.OpenObject($myCustomCommandAdsPath, $null, $null, 0)

# Delete the command
$myCustomCommand.DeleteObject("ADM_DELETEOBJECTFLAGS_AUTO") 

See also