none
Where are User Environment Variables %homedrive%, %homepath% set?

    Question

  • Hello Folks,

    maybe someone here can help. In a Windows 2008 R2 (+Xenapp 6) Environment, when I set user environment variables via "Advanced Settings" - "Environment Variables" those settings are not set throughout the user session. For example: If I open a command prompt after setting the environment variables (f.e. %HOMEDRIVE% -> H: and %HOMEPATH% -> \) and execute the set command, the previously configured environment variables are not active. It still shows the old variables %HOMEDRIVE% -> C: and %HOMEPATH% -> C:\Users\name...

    Even if I enter the environment varibale into Windows Explorer (f.e. %homepath%), it jumps right to the location of the old variable.

    I even set the user environment variable via VBscript, which works quite nice (checked in "Advanced Settings" - "Environment Variables"), however if I try another set command, it still shows the old variables! Windows Explorer jumps to the old locations as well...

     

    Any ideas?

     

    Monday, May 09, 2011 2:48 PM

Answers

All replies

  • HOMEDRIVE, HOMEPATH & HOMESHARE are set and updated via Active Directory. HOMEDRIVE & HOMEPATH are set even without a home drive set on the account; however they will be overridden by any user account properties set in AD.

    Also see these KB articles:


    This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
    Monday, May 09, 2011 3:44 PM
  • Thanks!
    Just something additional, in case someone should find this thread through a search...

     

    User Environment Variables can also be set via the Dos-command SET, SETX and also through Registry (HKCU\Environment).

    For example via VBscript, you could use:

    objShell.Run("cmd /c set.exe HOMEDRIVE=H:")
    and/or
    objShell.Run("cmd /c setx.exe HOMEDRIVE H:")

    or set the appropriate Registry-Keys in HKCU\Environment and HKCU\Environment\Volatile

    Just make sure you take notice of the way how SET and SETX work. While SET only sets the Environment Variables in the currently open CommandPrompt and discards the Setting after the CommandPrompt has been closed, SETX writes the Variables permanently - but only for all following CommandPrompts... That drove me almost nuts, while I was figuring stuff out...

     

     

    Monday, May 16, 2011 8:10 AM