Skip to content

Enabling and disabling Custom Commands

The following code sample shows how to enable and disable 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 the 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)

# Enable the Custom Command
$myCustomCommand.Disabled = $False
$myCustomCommand.SetInfo()

# Disable the Custom Command
$myCustomCommand.Disabled = $True
$myCustomCommand.SetInfo()

See also