Try this, if you can get the user id from the remotre machine then the following code will return the full name from AD. 'Script by Tomriddle 2010
on error resume next
strUserID=inputbox("Enter UserID", "Return Full Name From AD")
Set objRootDSE = GetObject("LDAP://RootDSE")
strDomain= objRootDSE.Get("defaultNamingContext")
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT distinguishedName FROM 'LDAP://"&strDomain&"' WHERE objectCategory='user' " & _
"AND sAMAccountName='"& strUserID &"'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
DistinguishedADPath=objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop
if DistinguishedADPath="" then
Msgbox strUserID&" Not found in AD"
else
Set objUser = GetObject ("LDAP://" & DistinguishedADPath)
msgbox objUser.displayName
end if
<message edited by TomRiddle on Wednesday, March 10, 2010 3:04 PM>