How to update value of SystemInformation.UserName in Vista

  • Thread starter Thread starter Dean Slindee
  • Start date Start date
D

Dean Slindee

When I loaded Vista it appears that I entered my FirstName/LastName in one
of the setup parameters. So, when I launch an application that I have
written and get the value in SystemInformation.UserName, the value returned
is "SLINDEED\Dean Slindee". What I want to be returned is
"SLINDEED\dslindee". "dslindee" is the value that shows on the startup
screen, and is also the administrator account. How can I change "Dean
Slindee" to "dslindee"?

Thanks,
Dean S
 
Dean Slindee said:
When I loaded Vista it appears that I entered my FirstName/LastName in one
of the setup parameters. So, when I launch an application that I have
written and get the value in SystemInformation.UserName, the value
returned is "SLINDEED\Dean Slindee". What I want to be returned is
"SLINDEED\dslindee". "dslindee" is the value that shows on the startup
screen, and is also the administrator account. How can I change "Dean
Slindee" to "dslindee"?


Hi Dean,

It sounds like you have the Account Name and the Full Name back-to-front.
In a normal scenario, user Fred Smith will have Account Name "fsmith" and
Full Name "Fred Smith". When Fred Smith calls SystemInformation.UserName, it
would return "fsmith" - the Account Name (not the Full Name).

In your case, it sounds like you have account name "Dean Slindee" and Full
Name "dslindee".

Local accounts are a bit weird, coz you don't have the full ADSI/LDAP
apparatus. But I think you can change this pretty easily in Administrative
Tools, Computer Management. In the Computer Management snap-in, go to Local
Users and Groups, Users, and locate "Dean Slindee" in the Name column.
You'll probably see in the Full Name column "dslindee".

Right click the account record and choose "Rename". Change "Dean Slindee" to
"dslindee". Optionally, you might choose to change the Full Name "dslindee"
to "Dean Slindee" ... but that has no effect on the value returned by
SystemInformation.UserName.

SystemInformation.UserName generally returns just the user's name (ie
account name), not the full LanMan-style DOMAIN\user formatted name. For
that, you may need to get the SystemInformation.UserDomainName property,
then catenate the string with a "\" in the middle.

Hope it helps,
 
Back
Top