WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADSI
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Get Users Full Name from their Logon ID

Keywords: 	 get users full name from their logon ID 

Question:

We are running win2k servers and I need to get the user's full name useing only the user's ID from the AD... Have had lots of trouble trying to figure out how to do this...if anyone out there can shoot some basic code for this I would greatly appreciate it....not asking for someone to write the code but just some sample stuff.....

Answer:

You can use the ADSi extender's "dsFindPath" to locate the user object in active directory and obtain the path. The user object has both a "givenName" (first name) and "sn" (surname) property. You can use the ADSi extender function "dsGetPropertty" to get the values for both properties. For example:
UserPath = dsFindPath(ServerPath, "(&(objectCategory=person)(sAMAccountName=mysam))")

FirstName = dsGetProperty(UserPath, "givenName)
LastName = dsGetProperty(UserPath, "sn")

Article ID:   W15387
File Created: 2003:05:13:11:27:26
Last Updated: 2003:05:13:11:27:26