none
Environment variable USERNAME on windows 2008 SP2

    Question

  • Hi all,

    Just a little question, why the environment variable is define to USERNAME=SYSTEM

    Can i delete this variable, we have trouble with a service that start with a user profil but  keep this variable

    Why this variable is here ? What is the reason ?

    Friday, July 09, 2010 5:35 PM

All replies

  • Hi,
     
    username should be set to the user name of the currently logged on user.
    Is the service running as the local system account instead of a user
    account? This can be checked by going to start -> control panel ->
    administrative tools -> services. Here the service properties -> logon
    tab should show the user that the service is running as.
     
    If the user logs on interactively, is the variable set correctly? The
    easiest way to check this is to open a command prompt and type
     
    set
     
    and press enter. This variable is meant to hold the user name of the
    currently logged on user,
     
    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds_shelloverview.mspx?mfr=true
     

    -- Mike Burr
    • Proposed as answer by Steve Kline Saturday, July 10, 2010 4:04 AM
    • Unproposed as answer by kroustibat Saturday, July 10, 2010 6:59 AM
    Friday, July 09, 2010 11:08 PM
  • Hi,

    The service is launch with a user, when i logon with this user, the variable is OK, but in non interactive session (when the service launch a command) i made a set command and th result is :

    ......

    USERNAME=SYSTEM

    USERNAME=testuser

    ......

    Very strange, but when i made a echo %USERNAME% after the set command the result is USERNAME=SYSTEM

    So USERNAME=testuser do not replace the system variable. To correct the problem i need to delete the system environment variable USERNAME=SYSTEM 

    My question is why this variable is put by default on windows VISTA/2008/7 system (not on 2000/XP/2003) ?

    Can i delete ?

    Saturday, July 10, 2010 7:05 AM
  • Hi,

    I went ahead and tried this and I didn't notice any immediate effect and I could not find documentation that describes any potential problems; however I would be uncomfortable with removing the variable without more extensive testing. If there is a workaround available, I would still go that route first. If I might ask, why is this variable causing problems?

    When I logged in after removing the variable, the %username% variable was still set to my username (presumably a user variable instead of a system variable).

    I read some old documentation going back to Windows 2000 that the environment variables for the system are not actually changed until the system is restarted and the environment variables for a user are set when the user logs on.


    -- Mike Burr
    Saturday, July 10, 2010 6:56 PM
  • Hi,

    I'm not the only one with this problem, this is the same that this one :

    https://fogbugz.bitvise.com/default.asp?WinSSHD.1.12003

    So... ? 

    Saturday, July 10, 2010 9:48 PM
  • Hi,

    I'm not the only one with this problem, this is the same that this one :

    https://fogbugz.bitvise.com/default.asp?WinSSHD.1.12003

    So... ? 


    Hello,

    and if i read that article correct, the solution is included.


    Best regards Meinolf Weber Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
    Saturday, July 10, 2010 10:15 PM
  • Yes, but my question is why the environment variable is define to USERNAME=SYSTEM by default and not in XP/2000/2003 ?


    Sunday, July 11, 2010 8:36 PM