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!