Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Full Name in AD from login name

Status
Not open for further replies.

sparkbyte

Technical User
Joined
Sep 20, 2002
Messages
879
Location
US
I need a sub that will find a users full name (displayName) from their (sAMAccountName).

I have a script that I am working on where I am outputing file attribute information and want to display the given name as the "owner" rather than the sAMAccountName.

Thanks

Thanks

John Fuhrman
faq329-6766
 
.DisplayName may be available through the WinNT provider

Set objUser = GetObject("WinNT://domain_name," & strUserName & ",user")
Msgbox objUser.DisplayName

''''this is interesting but might not be of use right now
Set objTrans = CreateObject("NameTranslate")
objTrans.Set 3, "domain_name_here\" & strUserName
'add a $ for a computer name
strUserDN = objTrans.Get(1)
Msgbox strUserDN
Set objUser = GetObject("LDAP://" & strUserDN)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top