' Specify the NT name of the user, or retrieve the NT name ' of the current user from the WshNetwork object. strNTName = "A546215" ' Constants for the NameTranslate object. Const ADS_NAME_INITTYPE_GC = 3 Const ADS_NAME_TYPE_NT4 = 3 Const ADS_NAME_TYPE_1779 = 1 ' Determine DNS domain name from RootDSE object. Set objRootDSE = GetObject("LDAP://RootDSE") strDNSDomain = objRootDSE.Get("defaultNamingContext") ' Use the NameTranslate object to find the NetBIOS domain name from the ' DNS domain name. Set objTrans = CreateObject("NameTranslate") objTrans.Init ADS_NAME_INITTYPE_GC, "" objTrans.Set ADS_NAME_TYPE_1779, strDNSDomain strNetBIOSDomain = objTrans.Get(ADS_NAME_TYPE_NT4) ' Remove trailing backslash. strNetBIOSDomain = Left(strNetBIOSDomain, Len(strNetBIOSDomain) - 1) ' Use the NameTranslate object to convert the NT user name to the ' Distinguished Name required for the LDAP provider. objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName strUserDN = objTrans.Get(ADS_NAME_TYPE_1779) ' Bind to the user object in Active Directory with the LDAP provider. Set objUser = GetObject("LDAP://" & strUserDN) DisplayMessage = "For User: " & strNTName & chr(10) & _ "User Object = " & "LDAP://" & strUserDN & chr(10) & _ "objUser.FullName = " & objUser.FullName & chr(10) & _ "objUser.Name = " & objUser.Name & chr(10) & _ "objUser.LastName = " & objUser.sn & chr(10) & _ "objUser.SAMAccountName = " & objUser.SAMAccountName & chr(10) & _ "objUser.DisplayName = " & objUser.DisplayName wscript.echo DisplayMessage