This should work:
strUserName = *INSERT NAME HERE*
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://dc=bob,dc=foo,dc=com>;(&(objectCategory=User)" & _
"(samAccountName=" & strUserName & ));displayName;subtree"
Set objRecordSet = objCommand.Execute
Wscript.echo objRecordset(0)
Its definitely not as clean as ADFind, but it works.
-Ryan
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marie-Therese Fahmy
Sent: Thursday, February 17, 2005 1:38 PM
To: [email protected]
Subject: [ActiveDir] script to convert userID to first and lastname of users
I need a script to search for userID for users and give me their full name.
We have Active Directory 2003.
Thanks,
Marie
List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/
List info : http://www.activedir.org/List.aspx
List FAQ : http://www.activedir.org/ListFAQ.aspx
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/