This will do it when run from the local machine. To get it to work against a
remote machine will take a bit of tweaking, but this may get you started.
Watch for line wraps....
Hunter
==================================================================
set objComputer = CreateObject("Wscript.Network")
strUserName = objComputer.UserName
set objComputer = Nothing
wscript.echo strUserName
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADSDSOObject"
adoConnection.Open "", "", ""
Set RootDSE = GetObject("LDAP://RootDSE")
searchRoot = RootDSE.Get("defaultNamingContext")
'On Error Resume Next
Set adoRecordset = adoConnection.Execute _
("<LDAP://" & searchRoot & ">;(&(objectCategory=Person)(sAMAccountName=" &
strUserName & "));" _
& "Name,ADsPath,sAMAccountName;SubTree")
While Not adoRecordset.EOF
wscript.echo adoRecordset.Fields.Item("Name").Value
adoRecordset.MoveNext
Wend
===============================================================