Looking back at my code, I use the LDAPQuery() UDF. This is basically the fnLDAPQuery() UDF but updated to our internal coding standards. (mostly comments and standardized var names.) Here are some snippets from the app:
 Code:
    ; return the DN for the specified user
    $sADsPath = 'LDAP://' + GetObject("LDAP://rootDSE").Get("defaultNamingContext")
    $sFilter = '(&(objectClass=User)(userPrincipalName=' + $aData[8] + '@*))'
    $aResults = LDAPQuery('AdsPath', $sADsPath, $sFilter)

    If Ubound($aResults) + Ubound($aResults, 2) > 0
      Left('ERROR: Multiple elements returned from query for user ' + $aData[8] + '!'  + ' ============================================================================', 70) ?
    Else
      'Updating ' $aData[8] ?
      For Each $Field in $aSourceFields
        $ = ADSIUserInfo(SubStr($aResults[0,0], 8), $aFields[$Field], $aData[$Field])
      Next
    EndIf
Note that "$aData[8]" represents the variable containing the user ID - change it accordingly. I've included some of the error trapping as well. I've also removed some code that clouds the concept - the important thing to recognize is how the data from $aResults is used in the ADSIUserInfo UDF.

The original script had an array of AD field names ($aFields) that mapped to the data exported from the HR system. Each record in the HR system was read into an array ($aData) which the ADSIUserInfo UDF used to update the parameter. That should help you understand what's going on in this code so you can extract what you need for your own. One of the tricky things is remembering that fnLDAPQuery returns an array, and the "LDAP://" prefix must be stripped before using the results in ADSIUserInfo.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D