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
$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)
# Enable the custom command
$myCustomCommand.Disabled = $false
$myCustomCommand.SetInfo()
# Disable the custom command
$myCustomCommand.Disabled = $true
$myCustomCommand.SetInfo()
See also
- Managing custom commands
- Binding to Adaxes-specific objects
- Managing Adaxes-specific objects
- IADs
- Online script repository