I am having a problem in a custom command binding to a user object to then get attributes from for use in the script. A little background:
- We have multiple domains managed by AdAxes
- I have done this before and it always worked.
I have a parameter in the custom command that is a text box, and automatically populates the initiator DN. I am assigning that to a variable in the script, and attempting to use it to get the user object.

My code that I have to bind to the user (and show me the values while I am debugging) is:
$initiatorDN = $Context.GetParameterValue("param-initiatorDN")
#debug
$Context.LogMessage("DN: " + $initiatorDN," Information")
$requestor = $Context.BindToObjectByDN($initiatorDN)
#debug
$Context.LogMessage("Requestor: " + $requestor, "Information")
$Context.LogMessage("sam: " + $requestor.samaccountname, "Information")
But when running that in the custom command I get (some details in pic redacted):

So the DN is passing to the variable, but the bind does not work. I have also tried the following bind commands:
$initiatorDN = $Context.GetParameterValue("param-initiatorDN")
#debug
$Context.LogMessage("DN: " + $initiatorDN," Information")
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")
$ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$service = $ns.GetServiceDirectly("localhost")
$requestor = $service.OpenObject("Adaxes://$initiatorDN",$null, $null, 0)
#debug
$Context.LogMessage("Requestor: " + $requestor, "Information")
$Context.LogMessage("sam: " + $requestor.samaccountname, "Information")
I still get the same result. I can't seem to bind by the DN no matter what approach I take.