Access level needed to look up username

S

sqlboy2000

Hi all,
I'm currently using the following call to look up a user's windows Full Name
from the domain controller:

Dim strFilter = "(&(sAMAccountname=" & strUser &
")(objectClass=user))"
Dim objEntry As New DirectoryEntry("LDAP://myDC", "user", "password")
Dim search As New DirectorySearcher(objEntry)
search.Filter = strFilter
Dim result As DirectoryEntry = search.FindOne.GetDirectoryEntry
Label1.Text = result.Properties("displayName").Value

This works fine, but my question is what are the minimum rights the user
account would need to look this value up? Do you need to be a domain admin to
access the user object and look up the Full Name?

I'm trying to set up an account with the least rights possible to lookup a
Full Name.

Thanks.
 
J

Joe Kaplan \(MVP - ADSI\)

This depends on the security settings on your AD, but in general a normal
domain user will be able to read displayName on most users.

I'd also recommend specifying AuthenticationTypes.Secure on your DE
constructor and suggest reading the displayName the SearchResult directly
rather than getting the DE via GetDirectoryEntry. It will be faster (fewer
round trips). You need to add "displayName" to PropertiesToLoad to have it
be in the SearchResult.

HTH,

Joe K.
 
S

sqlboy2000

Thanks for the info.

Joe Kaplan (MVP - ADSI) said:
This depends on the security settings on your AD, but in general a normal
domain user will be able to read displayName on most users.

I'd also recommend specifying AuthenticationTypes.Secure on your DE
constructor and suggest reading the displayName the SearchResult directly
rather than getting the DE via GetDirectoryEntry. It will be faster (fewer
round trips). You need to add "displayName" to PropertiesToLoad to have it
be in the SearchResult.

HTH,

Joe K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top