Where are User Environment Variables %homedrive%, %homepath% set? RRS feed

  • 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 9, 2011 2:48 PM


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 9, 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:")
    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
  • What if I have a user that keeps getting Z: set as %homedrive%, but AD points to H: drive? I can't figure out where the Z: drive setting is coming from.
    Thursday, August 27, 2015 6:40 AM
  • I know this is an old post but I had this exact same issue where AD would display H but map to Z. I discovered that the script I used for new user setup was setting the HomeDrive as "H" instead of "H:". Setting to H: thru powershell or manually in AD by switching to another drive letter, saving, then switching back to H: fixed the issue
    Thursday, June 29, 2017 1:22 PM