Skip to content

Deleting Custom Commands

The following code sample deletes a Custom Command.

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

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

# Bind to 'My Command' Custom Command
$customCommandsPath = $admService.Backend.GetConfigurationContainerPath(
    "CustomCommands")
$customCommandsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" `
    $customCommandsPath
$myCustomCommandAdsPath = $customCommandsPathObj.CreateChildPath( `
    "CN=My Command")
$myCustomCommand = $admService.OpenObject($myCustomCommandAdsPath, $NULL, $NULL, 0)

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

See also