I wasn't saying that it was the way it was listed in AD that was the problem.
I was suggesting that it had to do with the way the person who was adding the
user to SharePoint was logged in. As a later reply stated it probably does have
something to do with whether the person adding the user was logged in to a
machine that had the SharePoint site in the Trusted Sites zone or not. When the
person is added to SharePoint a record is created. This is NOT the profile
record, that is created separately. When the person is added to SharePoint it
will generate a Display name for them in the People and Groups table. If that
gets created wrong then it needs to be fixed manually (your program is one
solution). Its not the AD properties, it's the way the person is being added
to SharePoint, or something about the workstation of the person who is doing the
adding.