When you say you “searched for “jonathon stone” in AD”, do you mean you used the Find dialog in Active Directory Users and Computers? If so, that console’s search functionality actually works on several fields of the user objects. In your example, I would imagine that the user’s givenName attribute is set to “Jonathon”, even though the CN and/or displayName are showing “Jon”.
Yep, that’s awkward. You can either write some moderately complex parsing and filter building logic in your script, or just settle on a particular format to use in your file. Personally, I would lean toward putting logon names in the file (SamAccountName), avoiding the need for any tricky logic, and also avoiding the possibility of getting multiple results from your search (unless you’ve got duplicates due to a replication conflict.)
Unfortunately… The company i work for didnt approach this logically as you have suggested so displaynames are different usernames are awkward e.t.c shrug i have dealt with this now and manually found 200 email addresses! but i did wonder why powershell struggled when AD didnt!
Oh well at least i know its not something i was doing wrong!