Hello,
In your script, you need to bind to the target user involving Adaxes functionality using the $Context.BindToObjectByDNEx method with the second parameter set to $True. Finally, the script will be like below. In the script, the $commandDN variable specifies the distinguished name (DN) of the Custom Command to be executed.
$commandDN = "CN=my command,CN=Custom Commands,CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes" # TODO: modify me
# Bind to the Custom Command
$command = $Context.BindToObjectByDN($commandDN)
# Specify arguments for command execution
$commandArguments = $command.CreateArguments()
$commandArguments.SetParameterValue("MyParameter1", "MyValue1")
$commandArguments.SetParameterValue("MyParameter2", "MyValue2")
# Bind to the target user
$user = $Context.BindToObjectByDNEx("%distinguishedName%", $True)
# Execute the Custom Command for the user
$user.ExecuteCustomCommand($command.CommandID, $commandArguments)
If you still have issue running the script, please, send us (support[at]adaxes.com) the full script you are using and a screenshot of the configuration object (e.g. Business Rule, Scheduled Task) that runs the script.