I know how to get the logged in user name, but how would one get the actual name associated with the logged in user?
ex:
username - domain\jdoe
full name - john doe
how does one get the full name?
Printable View
I know how to get the logged in user name, but how would one get the actual name associated with the logged in user?
ex:
username - domain\jdoe
full name - john doe
how does one get the full name?
Do you mean like who the system is registered to? If not im not sure what you mean, if you already got the user name...
What do you mean by full name? When you create an Account in Windows, you specify the user name and what level of access you want them to have and that's it. There is no full name saved.
If you're talking about converting jdoe into John Doe... well that's impossible because that could also mean Jack Doe, Jammie Doe, etc... You also can't be sure a user name is the first initial and the last name (Mine is only my first name).
When your part of a domain your user account has several fields and properties available that a local one doesnt have.
You will have to WMI to get this information. Set a reference to System.Management.DLL and then try to use Win32_UserAccount Class to get the desired information.Quote:
Originally Posted by dannerbo