Hello Martin,
Unfortunately, it is not possible. Disabled Custom Commands can only be executed in Business Rules, Scheduled Tasks and other Custom Commands. As a solution, you can first enable the command in your script and then disable it after execution as in the below example.
[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
$commandDN = "CN=My Command,CN=Custom Commands,CN=Configuration Objects,"+
"CN=Adaxes Configuration,CN=Adaxes"
$command = $admService.OpenObject("Adaxes://$commandDN", $NULL, $NULL, 0)
# Enable Custom Command
$command.Disabled = $False
$command.SetInfo()
# Specify arguments for command execution
$commandArguments = $command.CreateArguments()
$commandArguments.SetParameterValue("MyParameter", "MyValue")
# Bind to the Organizational Unit
$containerDN = "OU=My OU,DC=domain,DC=com"
$container = $admService.OpenObject("Adaxes://$containerDN", $NULL, $NULL, 0)
# Execute the Custom Command for all users in the Organizational Unit
$container.Filter = @("user")
foreach ($user in $container)
{
$user.ExecuteCustomCommand($command.CommandID, $commandArguments)
}
# Disable Custom Command
$command.Disabled = $True
$command.SetInfo()