0

One of my customers says that in his AD usernames have mixed case sometimes and besides that, that people are able to successfully login using another casing of usernames. So there might be an ExampleUser in the AD and Windows allows them to login with exampleUSER etc. as well.

But what is the impact on the environment variable USERNAME?

I have tested a bit myself without an AD and in all of my tests USERNAME had the value of the username as it has been created. So in case of ExampleUser created in Windows, using the login EXAMPLEuser provided ExampleUser as USERNAME. That happened for RDP where users are free to input usernames as well as using runas.

My customer said that this is not the case for him at least sometimes, but instead if ExampleUser in the AD logs in using exampleUSER, USERNAME really contains the value of the current login, exampleUSER. I've found another question describing that as well:

For some users in this office, %USERNAME% is always in the case they type it when logging in.

For other users, %USERNAME has until recently always been in the canonical case (for a user logging in as elenasimpson it returns ElenaSimpson), but last week mysteriously started only doing this sometimes and the rest of the time returning it as typed. Rebooting often toggles to the other behaviour.

What I did not found is any official docs from MS of what is the value of USERNAME under which setups and inputs of users. Are there any rules one can rely on?

Thanks!

0

Active Directory is case aware, but not case sensitive. I can't seem to find a Microsoft document directly on it, but that is the case. What that means, is the first time a user logs into a computer and they use EXAMPLEuser, it will create the user folder with that case. If you use ExampleUser, it will also use that case for that new computer.

I might double check to see if the customer is comparing apples to apples. Does he have a domain or a work group? Is he using an app that is case aware? Can he log into the same computer with the two "different" accounts? If it's on a domain, compare the two accounts Common Name, pre-Windows 2000 logon, and userPrincipalName.

  • The customer is using AD and the problem is not related logins, that works as expected. It's only that USERNAME is forwarded by my application to places like paths 1:1 currently and customer says this variable depends on the current login of the user. That might result in different paths or values in some text files regarding casing, which is not a problem for Windows/NTFS, but might be for integration with other services on e.g. Linux. Lower-casing evything is easy of course, but I would like to know the rules for documentation purposes. – Thorsten Schöning Oct 11 '18 at 7:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.