How do I find the full name, rather than logon name, of the current user?

0

1

I log on as jd123, but in the Windows Start Menu, my name is displayed as "John Doe". Obviously, Windows knows how to look up my full name from the LDAP server. Is that information stored in an environment variable somewhere?

Jonas

Posted 2012-03-18T17:26:20.000

Reputation: 627

Take the time and research it online. There are plenty of vbscipts that can grab this informantion for you. – onxx – 2012-03-18T17:35:34.807

@onxx: The reason I asked the question was that I apparently didn't know the right keywords to research it online. Can you at least help me out that far? What is the name displayed in the start menu called? – Jonas – 2012-03-18T20:19:34.557

Try vbscript active directory username creditinals Im not sure on the specific name myself for that variable as it pulls it from the AD username name fields – onxx – 2012-03-18T21:24:50.373

Answers

2

In vbScript you can display the full name like this:

Set sysinfo  = CreateObject("ADSystemInfo")
Set oUser    = GetObject("LDAP://" & sysinfo.UserName & "")
strFullName  = oUser.Fullname

wscript.echo strFullName

There's no environment variable for this, but you can set it from the script by adding the following lines:

Set wshShell   = CreateObject( "WScript.Shell" )
Set wshUserEnv = wshShell.Environment( "USER" )
wshUserEnv("USERFULLNAME") = strFullName

ZEDA-NL

Posted 2012-03-18T17:26:20.000

Reputation: 418

That worked perfectly (sorry, it took me a while to find the time to try it out). Thanks! – Jonas – 2012-04-05T18:29:14.883

0

This article provides an interesting approach. Maybe it could even be adapted to wmic.

Der Hochstapler

Posted 2012-03-18T17:26:20.000

Reputation: 77 228