Then someone may help me with this function - I translated it to KIX but it raises an error and does not give back the desired value.

Code:

$strTest="LDAP://CN=DrShark,OU=1,OU=2,OU=3,OU=Test,DC=test,DC=dom"
$TestOU = getFirstOU($strTest)
MessageBox($TestOU,"")

Function getFirstOU($LDAP)

If instr(UCase($LDAP),"OU=")>0
$strStringAnfang=instr(UCase($LDAP),"OU=")+3
Else
$strStringAnfang=instr(UCase($LDAP),"DC=")+3
EndIf

$strStringEnde=instr(UCase($LDAP),",")
$strStringLength=($strStringEnde-$strStringAnfang)

$temp=Substr($LDAP,$strStringAnfang,$strStringLength)

getFirstOU=$temp

EndFunction