I'm trying to get the user logon name out with a query from Active Directory.
Whats the field name. I cant find it anywhere. I tried logon, logonname,
userlogon, login, loginname, etc.

cmd.CommandText = "select name, distinguishedname, profilepath, homedrive,
homedirectory, xxx" _
& " from 'LDAP:// OU= NY, DC=FFHSJ, DC=COM' WHERE objectCategory='user'"

Can someone help me out with what to put in the xxx to get the user logon
field from active directory?

Thanks.

Re: LDAP query help by Torgeir

Torgeir
Fri Mar 11 10:59:57 CST 2005

Tash wrote:

> I'm trying to get the user logon name out with a query from Active Directory.
> Whats the field name. I cant find it anywhere. I tried logon, logonname,
> userlogon, login, loginname, etc.
>
> cmd.CommandText = "select name, distinguishedname, profilepath, homedrive,
> homedirectory, xxx" _
> & " from 'LDAP:// OU= NY, DC=FFHSJ, DC=COM' WHERE objectCategory='user'"
>
> Can someone help me out with what to put in the xxx to get the user logon
> field from active directory?
Hi

samAccountName


Also, you should use

WHERE objectCategory='user' And objectCategory='person'


Some links that might interest you:

See "AD Attributes" (spreadsheets documenting Active Directory
attributes) here:
http://www.rlmueller.net/links_and_references.htm

A couple of other links:

AD Attributes
http://www.rlmueller.net/freecode5.htm

Names for Objects in Active Directory
http://www.rlmueller.net/Name_Attributes.htm


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx