Please read the entire article and not just the script. The information describes the logic of the script to (hopefully) make it easier to modify.
ChristopheM is correct - $UserDN is the LDAP DN String, not a user ID. You cannot simply replace a "ADSIUserInfo($UserDN, 'ObjectID')" function call with a ReadProfileString() function.
I would allow the script to complete the creation of the variables from the many ADSIUserInfo() calls, and THEN use the various values to determine IF a replacement value exists, then use it (my earlier IIF() example). Also, creating a lookup of values by userid creates many duplicates. Use a single "REPLACEMENTS" section so you only list things like City, State(Region) and names once.
Glenn
_________________________
Actually I
am a Rocket Scientist!